我正在使用Notifications API(Twilio Java SDK版本7.24.2)。我已成功使用Notification API发送短信,如:
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();
}
现在,如果我想通过上述方法返回的通知的SID获取Notification的状态,我该怎么办? Twilio的Java Notification的API是否提供了通过其SID查找Notification状态的任何方法(如果我不想使用寄存器回调URL方法)?
Twilio开发者传道者在这里。
如果您只是通过短信一次发送一个通知,那么我建议您只使用Messages API。这样API将返回消息SID,然后您可以将其用于look up the Message with the API并检查其状态。
无法查找通过Notify发送的所有邮件以检查其状态。建议的方法是注册StatusCallbackUrl
以获取每个状态的更新。
如果这有帮助,请告诉我。