I have a Twilio number that is setup to execute a webhook when a message is received. I would like to include a link in the response I send back to the user. ie.
Please login to XYZ.com at https://login.xyz.com/?client=SMS&userid=abc
However, when i send this in reply I get a schema validation error in the Twilio debugger with the following message.
Warning - 12200
Schema validation warning
The provided XML does not conform to the Twilio Markup XML schema. Please refer to the specific error and correct the problem.
This is the message body:
<Response>
<Message>Please login to Botler at 'https://login.xyz.com/?client=Twilio&userid=foobar'</Message>
</Response>
I tried url encoding the url and I no longer get a schema validation error however the link in the sms is not clickable (it contains all of the escape characters).
How can i send a link in SMS and have it be clickable by the user?
Thanks.
Solution
After much trial and error I found a solution that works. I can wrap the url in CDATA element and it passes schema validation and the link is correctly interpreted by phones. For example,
<Response>
<Message>Please login to Botler at <![CDATA[https://login.xyz.com/?client=Twilio&userid=foobar]]></Message>
</Response>
The SMS is just text. The device has to get that text and detect that is a link to make it clickeable.
Following the doc here the problem is caused by:
Hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With