FabGre Rtone
FabGre Rtone

Reputation: 135

"The From phone number is not a valid" with a US number

I'm new on Twilio and try to use JAVA API to send SMS. As I saw on other posts in SoF, I release my local first number and buy a US number to have a full features number. But I always have error message :

com.twilio.sdk.TwilioRestException: The From phone number +14065302461 is not a valid, SMS-capable inbound phone number or short code for your account.

my code is :

        SmsFactory messageFactory = mainAccount.getSmsFactory();
        List<NameValuePair> messageParams = new ArrayList<NameValuePair>();
        messageParams.add(new BasicNameValuePair("To", "<myphonenumber>"));
        messageParams.add(new BasicNameValuePair("From", "+14065302461"));
        messageParams.add(new BasicNameValuePair("Body", message));

        try {
            messageFactory.create(messageParams);
            LOGGER.info("SMS sent");
        } catch (TwilioRestException e) {
            LOGGER.error("Unexpected exception during SMS sending : ", e);
        }

My number is valid for SMS as you can see in that ps :

enter image description here

My code works with the magic number +15005550006.

Any suggestion ?

Thanks,

Upvotes: 3

Views: 2970

Answers (1)

FabGre Rtone
FabGre Rtone

Reputation: 135

OK understood the problem. I used my "Test AccountSID" instead of my "Live AccountSID". Perhaps a specific error message could be useful on this case.

Upvotes: 7

Related Questions