Skip to Content
All blog posts

Twilio delivery issues

 — #Twilio#Javascript

Problem

Recently while updating onpro app to send out automatically SMS , I encountered a weird error where I wasn't able send out messages to US numbers but worked for other countries - my code looked like this:

 app.post('/send-sms', function  (req, res) {
  client.messages
  .create({
     body: req.body.message,
     from: process.env.SENDER_PHONE,
     to:   process.env.TARGET_PHONE
   })
  .then(message => console.log(message.sid));
 })

When trying to query the endpoint send-sms, I wouldn't get message.sid on my terminal, meaning the sms didn't go through.

The error was coming from the the twilio number not being international.

Solution

Turns out the fix was to make the twilio number actually interational on the twilio panel, after changing the sender number to international, I was able to send out SMS again. 🤷‍♀️