How to get the status of a Twilio Notification using the sid?

夙愿已清 提交于 2019-12-25 00:04:05

问题


I am using the Notifications APIs (Twilio Java SDK version 7.24.2). I've successfully sent the SMSes using the Notification API like: private String sendMessageThroughNotificationService(String message, PhoneNumber receiverPhoneNumber){ Notification notification = Notification.creator(twilioNotificationSID) .setBody(message) .setToBinding(Promoter.listOfOne("{\"binding_type\":\"sms\", \"address\":\""+receiverPhoneNumber.toString()+"\"}")) .create(); return notification.getSid(); }

Now, what should I do if I want to get the Notification's status through the SID of the notification that I am returning from the above method? Does Twilio's Java Notification's API provide any way to find the Notification's status through its SID (if I don't want to use the register callback URL approach)?


回答1:


Twilio developer evangelist here.

If you are only sending one notification at a time via SMS, then I recommend you just use the Messages API. That way the API will return the Message SID, which you can then use to look up the Message with the API and check its status.

There is no way to look up all the messages sent via Notify in order to check their statuses. The recommended method there is to register a StatusCallbackUrl to get updates on each status.

Let me know if that helps at all.



来源:https://stackoverflow.com/questions/52149057/how-to-get-the-status-of-a-twilio-notification-using-the-sid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!