I have a Upgraded Twilio Account and I want to send sms to any number using that Account. When I try to send sms from http://bit.ly/twiliosms, the SMS is successfully sent to the users. But what I want is to send the sms from Auzre Mobile Service.
When a new Data is inserted to the Azure Mobile Service, I want a particular User to get an SMS. Here is the Code that I have written so far in my Azure Mobile Service's Script:
function insert(item, user, request) {
var httpRequest = require('request');
var sid = "<< My SID >>";
var token = "<< My TOKEN >>";
var url = "https://" + sid + ":" + token +
"@api.twilio.com/2010-04-01/Accounts/" + sid + "/SMS/Messages.json";
var body = "From=" + "+1234567890" + "&To=" + "+88017*********" + "&Body=" + "Hello World, how are you.";
httpRequest.post({
url: url,
headers: { 'content-type': 'application/x-www-form-urlencoded' },
body: body
}, function (err, resp, body) {
console.log(body);
});
request.execute();
}
I have properly inserted my SID and TOKEN as well the From and To Phone numbers. But the SMS is not being sent although Data is being Inserted to the Table.
So what can I do in here? Any help is highly appreciated. Thanks.
Edit:
I have seen the Log. It says that my To Number is invalid. But it is my personal Phone number:
{"code": 21211, "message": "The 'To' number 8801******* is not a valid phone number.", "more_info": "https://www.twilio.com/docs/errors/21211", "status": 400}
I have tried seeing the Doc. But no suitable solution is available. So, your help is highly appreciated. Thanks.