I am unable to send SMS message from a US twilio number to a UAE twilio number. Also in the geographical settings, sending SMS to UAE numbers is enabled.
I am pasting code here:
const accountSid = '<account-sid>';
const authToken = '<auth-token>';
const client = require('twilio')(accountSid, authToken);
client.m
.create({
body: 'This is the ship that made the Kessel Run in fourteen parsecs?',
from: '<us-number>', // example: +12345678901 country code is +1
to: '<uae-number>' // example: '+971123456789' country code is +971 (also i tried different uae numbers, didn't work)
})
.then(message => console.log(message.sid)).catch(error => console.log(error.message));
I am getting error text: Message cannot be sent with the current combination of 'To' (+97112345XXXX) and/or 'From' (+12345678901) parameters
But if I hit the twilio voice call api with the same from
and to
parameters, it works like a charm. See example below:
client.calls
.create({
twiml: '<Response><Say>Hello, this is a test voice call from Twilio.</Say></Response>',
from: '<us-number>', // same us number
to: '<uae-number>', // same uae number,
})
.then(call => console.log(`Call SID: ${call.sid}`))
.catch(error => console.error(`Error making voice call: ${error.message}`));
It will successfully return a call sid.
I am pretty clueless what's wrong with the message here, anyone faced a similar issue there, meanwhile I have sent support to twilio and waiting for their reply since hours!
Got solution from twilio support, I have to register alphanumeric sender ID for UAE: https://support.twilio.com/hc/en-us/articles/360046382293-Documents-Required-and-Instructions-to-Register-Your-Alphanumeric-Sender-ID-in-UAE