Java – invalid from phone number with us number
•
Java
I am a novice of twilio and try to send text messages using Java API As I saw in other sof posts, I posted my first local number and purchased a U.S. number to get the full feature number But I always have an 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. You can see in PS:
My code uses magic number 15005550006
Any suggestions?
thank you,
Solution
To understand the problem I used "test accountsid" instead of my "live accountsid" Perhaps a specific error message might be useful for this case
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码