如何使用 sid 获取 Twilio 通知的状态?

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

我正在使用通知 APIs(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来获取通知的状态,该怎么办? Twilio 的 Java 通知的 API 是否提供任何方法来通过其 SID 查找通知的状态(如果我不想使用注册回调 URL 方法)?

此处为 Twilio 开发人员布道师。

如果您一次只通过短信发送一个通知,那么我建议您只使用 Messages API. That way the API will return the Message SID, which you can then use to look up the Message with the API 并检查其状态。

无法查找通过 Notify 发送的所有消息以检查它们的状态。推荐的方法是注册一个 StatusCallbackUrl 以获取每个状态的更新。

如果有帮助请告诉我。