简体   繁体   English

使用试用 twilio 帐户发送短信

[英]Send SMS with trial twilio account

I want to try to send SMS to a cellphone in Austria.我想尝试向奥地利的手机发送短信。 I have set up a free trial Twilio account to do so.为此,我设置了一个免费试用 Twilio 帐户。 however, my Twilio account seems not to be capable of doing so.但是,我的 Twilio 帐户似乎无法这样做。 but I think it should be possible to send SMS with the trial account?但我认为应该可以用试用帐户发送短信?

This is a screenshot of my Twilio number where you can see that it's not capable of messaging:这是我的 Twilio 号码的屏幕截图,您可以在其中看到它无法发送消息:在此处输入图像描述

this is the exception i get when running my python-code which tries to send the SMS:这是我在运行尝试发送 SMS 的 python 代码时遇到的异常:

twilio.rest.exceptions.TwilioRestException: HTTP 400 error: 21606: The From phone number +43720881723 is not a valid, SMS-capable inbound phone number or short code for your account.

any idea on how I can get this running?关于如何运行它的任何想法? in other words: how can I activate SMS-capability for my free Twilio account?换句话说:如何为我的免费 Twilio 帐户激活 SMS 功能? if this is possible, what are the limitations, ie, how many free SMS messages can I send?如果可行,有什么限制,即我可以发送多少条免费 SMS 消息?

thanks!谢谢!

To send SMS with trial twilio account TEST ACCOUNT SID and TEST AUTHTOKEN which is placed inside Phone Number > Tools > Test Credentials rather than ACCOUNT SID and AUTHTOKEN given by Console Dashboard > Account Summary.要发送带有试用 twilio 帐户 TEST ACCOUNT SID 和 TEST AUTHTOKEN 的 SMS,它位于电话号码 > 工具 > 测试凭据中,而不是控制台仪表板 > 帐户摘要提供的帐户 SID 和 AUTHTOKEN。

Because ACCOUNT SID and AUTHTOKEN is bind after you buy the twilio number and TEST ACCOUNT SID and TEST AUTHTOKEN is bind with +15005550006.因为ACCOUNT SID和AUTHTOKEN是你购买twilio号后绑定的,TEST ACCOUNT SID和TEST AUTHTOKEN绑定的是+15005550006。

If you received this error while trying to authenticate with your Test Credentials, you probably tried to send a message with a From number from your live account.如果您在尝试使用您的测试凭证进行身份验证时收到此错误,您可能尝试从您的真实账户发送带有发件人编号的消息。 The only number that can be used to send successful messages with your Test Credentials is +15005550006唯一可用于使用您的测试凭证发送成功消息的号码是 +15005550006

If you use this number +15005550006 along with your 'demo' twilio sid and token, this will show you the success (no error) but it actually not sending you any sms/ text.如果您将此号码+15005550006与“演示”twilio sid 和令牌一起使用,这将显示成功(没有错误),但实际上不会向您发送任何短信/文本。

Go to this page https://www.twilio.com/console/sms/getting-started/build and set a phone number like "+133438*****".转到此页面https://www.twilio.com/console/sms/getting-started/build并设置电话号码,例如“+133438*****”。 Twilio will auto provide you a number like (334) 384-**** and by clicking the buttons you need to generate the phone number as like "+133438*****". Twilio 会自动为您提供一个类似 (334) 384-**** 的号码,通过单击您需要的按钮来生成类似“+133438*****”的电话号码。 Once you successful, try to use your 'live' sid and token number within the API.成功后,尝试在 API 中使用您的“实时”sid 和令牌号。 But before integrating the same, you can fire a SMS in your own phone number from this page https://www.twilio.com/console/sms/getting-started/build .但是在集成之前,您可以从这个页面https://www.twilio.com/console/sms/getting-started/build 用自己的电话号码发送短信。

Otherwise, the API error message will show you that - [HTTP 400] *Unable to create record: The 'From' number +1*********** is not a valid phone number, shortcode, or alphanumeric sender ID .否则,API 错误消息将显示 - [HTTP 400] *无法创建记录:“发件人”号码 +1***********不是有效的电话号码、简码或字母数字发件人 ID

Your number is not capable (configure) for SMS sending.您的号码无法(配置)发送短信。 Go to your account and enable SMS capability.转到您的帐户并启用 SMS 功能。 After that you will see a green check mark with text " https://demo.twilio.com/welcome/sms/reply/ " instead of Messaging" . Similar to below screenshot之后,您将看到一个带有文本“ https://demo.twilio.com/welcome/sms/reply/ ”而不是Messaging的绿色复选标记。类似于下面的屏幕截图在此处输入图片说明

If your number is sms capable and still you are getting the 21606 error, then check 'Active Numbers' tab under 'Manage Numbers'.如果您的号码可以发送短信,但仍然收到 21606 错误,请检查“管理号码”下的“活动号码”选项卡。 It should show your number '+43720881723' as an active number.它应该将您的号码“+43720881723”显示为有效号码。

I got this error when I was using test Account SID and test Auth Token along with a regular number.我在使用测试帐户 SID 和测试身份验证令牌以及常规号码时遇到此错误。 Then I changed the Account SID and Auth Token to the regular ones and it worked as expected, ie allowed me to send SMS to a verified phone number.然后我将帐户 SID 和身份验证令牌更改为常规的,它按预期工作,即允许我向经过验证的电话号码发送短信。

I had found two errors in this regard, the problem is in the evaluation account and its limitations, but I found a way around it, within the rules of twilio.我在这方面发现了两个错误,问题在于评估帐户及其局限性,但我在 twilio 的规则内找到了解决方法。

Access this page and follow the instructions: https://www.twilio.com/console/sms/get-setup访问此页面并按照说明操作: https : //www.twilio.com/console/sms/get-setup

Write down the number he gives you, this will be your new number, paste it in your application, it will solve your problem, but you still need to do one last thing, you need to check the number you want to send the message to, access this page:记下他给你的号码,这将是你的新号码,粘贴到你的申请中,它会解决你的问题,但你还需要做最后一件事,你需要检查你想要发送消息的号码,访问此页面:

https://www.twilio.com/console/phone-numbers/verified https://www.twilio.com/console/phone-numbers/verified

After you do this, you can try to send the message again, if it fails, the problem must be elsewhere, as it worked for me.这样做后,您可以尝试再次发送消息,如果失败,则问题必须在其他地方,因为它对我有用。

To send SMS with trial Twilio account, test ACCOUNT SID and test AUTHTOKEN which can be found at Phone Number > Tools > Test Credentials rather than ACCOUNT SID and AUTHTOKEN given by Console Dashboard > Account Summary.要使用试用 Twilio 帐户发送 SMS,请测试帐户 SID 和测试 AUTHTOKEN,这可以在电话号码 > 工具 > 测试凭据中找到,而不是控制台仪表板 > 帐户摘要提供的帐户 SID 和 AUTHTOKEN。

In my case, upgraded my Twilio account and copied the US Florida phone number as it is (9549386330) and got "is not a valid, SMS-capable inbound phone number or short code for your account" I only needed to put "1" in front of 19549386330 and it worked.就我而言,升级了我的 Twilio 帐户并按原样复制了美国佛罗里达州的电话号码 (9549386330),结果“不是有效的、支持 SMS 的入站电话号码或您帐户的短代码”,我只需要输入“1”在 19549386330 面前,它奏效了。 so check the country code of your phone number as well.所以还要检查你的电话号码的国家代码。

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

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