Twilio Integration - Error code 21211, not a valid phone nr

So I follow this document step by step: Twilio Integration Plugin | Backendless Mobile Platform.

When I register a user, I keep getting a PlatformException with code 21211: PlatformException(21211, The ‘To’ number +27857882477 is not a valid phone number., The ‘To’ number +27857882477 is not a valid phone number., null).

What should the format be or should I have this number registered on Twilio? Not sure. I cannot download the generated API docs for some reason. I don’t really understand if the error is related to Twilio itself where I need to setup something or is it the format of the phone number? How can I check that Twilio is working? I do see the service under cloud code.

This code is giving the error:

BackendlessUser user = new BackendlessUser()
 ..email = "EMAIL-VALUE"
 ..password = "PASSWORD-VALUE";
user.setProperty("phoneNumber", "PHONE-NUMBER-VALUE");
Backendless.userService.register(user).then((registeredUser) {
   String transactionId = registeredUser.getProperty("transactionId");
 }
);

Regards

Solved the error.

Maybe for someone with the same error: I mistakenly used my own number in the setting up part of Twilio integration. I had to go back to Twilio and use a Trial Number provided and use that number in the setup of the integration under the field “Twilio Sender Phone Number:”

Can you maybe add that in the document as well? As someone new to Twilio, this was quite confusing. I could also not find the SID and token following the steps of the document. I found it using the link “My First Twilio Account”.

Regards

2 Likes

Hello @Jack_Jenkins

Thanks for spending time and sharing your experience with the community!

Regards, Vlad