使用Twilio发送短信后如何确保短信通过 [英] How to make sure a SMS went through after sending it with Twilio
问题描述
我正在使用网站上提供的Twilio java包装器并开始进行一些测试。我能够发送成功收到的短信。但是,我想确保消息已成功发送,并且Twilio没有遇到任何问题(电话号码不好或任何原因)。
I am using the Twilio java wrapper provided on the website and started making some tests. I am able to send text messages that are successfully received. However, I would like to make sure that the messages have been sent successfully and that no problem has been encountered by Twilio (bad phone number or whatever reason).
我理解当您向Twilio发送REST请求以发送SMS时,Twilio会响应状态。我怎么能得到这个回复?
I understand that when you make a REST request to Twilio to send a SMS, Twilio responds with the Status. How could I get this response?
这是我找到的解释页面: http://www.twilio.com/docs/howto/sms-notifications-and-alerts
Here is the explanation page I found: http://www.twilio.com/docs/howto/sms-notifications-and-alerts
推荐答案
如果您在发出SMS请求时指定了StatusCallback URL,我们将在消息处理完毕后向您提供的回调URL发出请求,并带有参数SmsStatus =已发送或SmsStatus =失败。您可以使用此信息对SMS消息进行更多处理。这里有更多信息: http://www.twilio。 com / docs / api / rest / sending-sms#post-parameters-optional
If you specify a StatusCallback URL when you make the request to send an SMS, we will make a request to the callback URL you provided after the message has finished processing, with the parameters either SmsStatus=sent or SmsStatus=failed. You can use this information to do more processing on the SMS message. There's more information here: http://www.twilio.com/docs/api/rest/sending-sms#post-parameters-optional
或者,如果你挂在SMS Message Sid上,你应该能够查询API以获取消息并获取响应中的状态。因此,如果sid是SM123,则向 https://api.twilio.com/2010-04-01/Accounts/AC123/SMS/Messages/SM123.json $ c $发出GET请求c>应该返回一个具有SMS消息状态的对象。
Alternately, if you hang on to the SMS Message Sid, you should be able to query the API for the message and get the status in the response. So if the sid is SM123, making a GET request to https://api.twilio.com/2010-04-01/Accounts/AC123/SMS/Messages/SM123.json
should return a object with the status of the SMS Message.
这篇关于使用Twilio发送短信后如何确保短信通过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!