2

I am getting this error from Twilio.

12200 Schema validation warning Description Invalid content was found starting with element 'Message'. One of '{Play

The markup is formed like this.

<?xml version="1.0" encoding="UTF-8"?>

<Response>
   <Message to="+999999999" from="+9999999">Thank you for request</Message>
   <Redirect>http://www.x.com/twiml/applet/voice/1/1df17f</Redirect>
</Response>
MasterScrat
  • 7,090
  • 14
  • 48
  • 80
arun kumar
  • 703
  • 2
  • 13
  • 33

1 Answers1

2

Twilio developer evangelist here.

This looks like it would be absolutely fine in response to an incoming SMS message. However, as your <Redirect> url suggests, this is a voice application. So, my guess is that you are trying to send an SMS message during the course of a call.

You can do that, but not using the <Message> verb. You need to use the <Sms> verb instead. The good news is, that's all you'd need to change. So your response would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Sms to="+999999999" from="+9999999">Thank you for request</Sms>
  <Redirect>http://www.x.com/twiml/applet/voice/1/1df17f</Redirect>
</Response>

Let me know if I've got this right or if my diagnosis was way off and I'll try to help again!

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Thanks, but this error message should really be made clearer! – MasterScrat Jul 10 '17 at 19:03
  • Also, it seems this uses the deprecated /SMS/Messages resource. What would be the way to do it now? – MasterScrat Jul 10 '17 at 19:39
  • This doesn't use `/SMS/Messages` as that is a resource in the REST API. If you want to send an SMS message as part of a voice call you should use the [`` element](https://www.twilio.com/docs/api/twiml/sms). – philnash Jul 10 '17 at 19:41
  • I see. But then why doesn't it provide delivery steps info? Does this depend on the country of the sending number? – MasterScrat Jul 10 '17 at 19:51
  • What do you mean "delivery steps info"? The error message is correct in that it is not valid in TwiML to place a `` element inside a voice response. The TwiML that you use does not depend on the country of a sending number either, and notably this is not the case of a number being sent to, but sending a message as part of a voice call. – philnash Jul 10 '17 at 19:55
  • The message is technically correct but come on it's weirdly formatted and looks truncated. For the "delivery steps": when I send an SMS using then look in the log under twilio.com/console/sms/logs/, I see: "Delivery Steps are not available" then a message about /SMS/Messages deprecation. Also the size is limited to 160 characters. Why am I not getting the upgrades described here? https://support.twilio.com/hc/en-us/articles/223181028-Switching-from-SMS-Messages-resource-URI-to-Messages-resource-URI- – MasterScrat Jul 10 '17 at 20:11
  • You're getting that when using `` in response to a voice call? Can you perhaps start a new question and give me all the context? Thanks! – philnash Jul 10 '17 at 20:13
  • Here you go! https://stackoverflow.com/questions/45020962/twilio-sms-sent-using-sms-limited-to-160-characters-and-without-delivery-step – MasterScrat Jul 10 '17 at 20:23