1

I am using Salesforce and Twilio API, but when I send a SMS message with more than 160 characters, I receive the message below.

TwilioRestException:[errorCode=21605, message=The message body exceeds the 160 character limit., moreInfo=https://www.twilio.com/docs/errors/21605, status=400]: Script-thrown exception

I looked the error page showed in the error message, but I didn´t figure out what I have to change in the API call to allow bigger messages to be sent. To install Twilio in my Salesforce org, I used this package: https://github.com/twilio/twilio-salesforce

Thanks in advance,

4

This is as per the old Twilio endpoint used in the wrapper Salesforce library. Internally it uses the /SMS/Messages endpoint which limits max size to 160 characters and is now deprecated. The error you receive in this case is expected and listed here.

You should now be using the new /Messages endpoint described here which allows up to 1600 characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.