简体   繁体   English

twilio 错误“发件人电话号码无效”

[英]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.我刚刚创建了一个帐户并尝试通过 python 帮助程序库测试 twilio API。 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. twilio.base.exceptions.TwilioRestException:HTTP 400 错误:无法创建记录:发件人电话号码 + 不是有效的、支持 SMS 的入站电话号码或您帐户的短代码。

I am using the SMS enabled number purchased via the twilio CLI.我正在使用通过 twilio CLI 购买的启用 SMS 的号码。 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)

turned out the step by step guide on Twilio site is not accurate (sufficient).原来 Twilio 网站上的分步指南不准确(足够)。 One first needs to create a messaging service via the dashboard and bind the phone number to it首先需要通过仪表板创建消息服务并将电话号码绑定到它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM