Search code examples
pythontwiliotwilio-apitwilio-programmable-chat

Twilio Outbound SMS Message Not Delivered


I'm using the following code to send an outbound SMS message from Twilio:

from twilio.rest import Client

account_sid = '<ACCOUNT SID>'
auth_token  = '<AUTH TOKEN>'

client = Client(account_sid, auth_token)

message = client.messages.create(to='<To mobile number>',
                                 from_='<Twilio phone number>',
                                 body='Stackoverflow is awesome!')

print('Message ID: ' + message.sid)

The code worked fine for my mobile number i.e. the messages are received on my phone and the Programmable Messaging Log shows the status Delivered. All good!

However, some of my friends/colleagues couldn't receive messages on their phones. When I checked the Programmable Messaging Logs, it shows the status Sent (and not Delivered). I couldn't figure out the possible issue and a working solution to this problem.

Any guidance will be really appreciated.


Solution

  • The issue is resolved.

    The Sent status of the messages that were not delivered eventually turned to Undelivered (Error: 30008) Unknown error. I went through this page and read about possible solutions to resolve Error 30008. Eventually, I figured out that I was using an exclamation mark (!) in the body text that was causing the problem. I removed the exclamation mark and the SMS was delivered successfully.