Veselin Vasilev
Veselin Vasilev

Reputation: 11

twilio error "The from phone number is not valid"

I just made an account and tried testing the twilio API via the python helper library. I am getting the error :

twilio.base.exceptions.TwilioRestException: HTTP 400 error: Unable to create record: The From phone number + is not a valid, SMS-capable inbound phone number or short code for your account.

I am using the SMS enabled number purchased via the twilio CLI. I am using the following code:

from twilio.rest import Client

# Your Account SID from twilio.com/console
account_sid = "####################"
# Your Auth Token from twilio.com/console
auth_token  = "###################"

client = Client(account_sid, auth_token)

message = client.messages.create(
    to="+1xxxxxxxx",
    from_="+1xxxxxxxx",
    body="Test message")

print(message.sid)

Upvotes: 0

Views: 1741

Answers (1)

Veselin Vasilev
Veselin Vasilev

Reputation: 11

turned out the step by step guide on Twilio site is not accurate (sufficient). One first needs to create a messaging service via the dashboard and bind the phone number to it

Upvotes: 1

Related Questions