3
votes

I'm using Parse cloud to send SMS for verification. this is my cloud js code im using

function sendCodeSms(countryCode, phoneNumber, code) {
    var promise = new Parse.Promise();
    twilio.sendSms({
        to: countryCode + phoneNumber,
        from: twilioPhoneNumber,
        body: 'Your login code for TestApp is ' + code
    }, function(err, responseData) {
        if (err) {
            console.log(err);
            promise.reject(err.message);
        } else {
            promise.resolve();
        }
    });
    return promise;
}

On Twilio Logs status says "Sent" but it is never delivered. Not sure what I'm doing wrong? It was working fine 2 days ago.

Here is the screenshot http://i.imgur.com/iDUbzKC.png

1

1 Answers

1
votes

Twilio developer evangelist here.

That code all looks correct and you're getting the message to Twilio, so that's all fine.

The status "sent" means that the message has been accepted by a carrier, however it is only when the message is "delivered" that the user should have received it. See the meanings of statuses here.

The other thing I noticed was that the number you sent to in your screenshot was an Indian number. There are some restrictions on sending to Indian numbers which you can read about here.

If you are doing phone verification/two factor authentication, you might be interested in Authy which allows you to perform those tasks in an easier way than just using Twilio. It can also do login code via an authentication application rather than SMS, which may be helpful in this situation too.

Let me know if this helps!