Twilio: SMS sent using limited to 160 charac

2019-08-03 03:53发布

问题:

I am sending an SMS with Twilio using the following TwiML code (from a bin). It is called at the end of a call, using the action parameter of the <Dial> verb.

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

<Response>
    <Sms from="+44XXXXXXXXXX" to="{{From}}">Recording of your call with {{To}}: {{RecordingUrl}}</Sms>
</Response>

It works, but if the message gets too long I get the error:

21605 Maximum body length is 160 characters

And I do not get Delivery Steps information in the SMS logs:

Delivery Steps

Delivery Steps are not available.

For messages sent with the deprecated /SMS/Messages Resource. Please upgrade to the Messages Resource to see Delivery Steps.

This link leads me to believe I am somehow using a deprecated API: https://support.twilio.com/hc/en-us/articles/223181028-Switching-from-SMS-Messages-resource-URI-to-Messages-resource-URI-

All the numbers involved are from UK, if this somehow has an influence.

回答1:

Twilio developer evangelist here.

It turns out that <Sms> under the hood, uses the deprecated /SMS/Messages endpoint to send messages during calls. This is why you are seeing the results you have shared above.

There is a bug open internally to provide <Message> within voice calls, but in the meantime the workaround is to use the REST API to send messages instead of TwiML.



标签: sms twilio