Delivery Report From Twilio Rest Api using Java



我正在尝试获取报告接收者是否收到短信的天气?我可以发送短信,但 Twilio 不会回调我指定的 URL以下是我的代码片段:-

// Create a rest client
  TwilioRestClient client = new TwilioRestClient(com.main.Constants.ACCOUNT_SID,                    com.main.Constants.AUTH_TOKEN);
 // Get the main account (The one we used to authenticate the client
   Account mainAccount = client.getAccount();
 // Get all accounts including sub accounts
  AccountList accountList = client.getAccounts();
  // Send an sms
  SmsFactory smsFactory = mainAccount.getSmsFactory();
  Map<String, String> smsParams = new HashMap<String, String>();
  smsParams.put("To", number); // Replace with a valid phone
  // number in your account
  smsParams.put("From", com.main.Constants.FROM); // Replace with a valid                                   
  smsParams.put("StatusCallback", com.main.Constants.CALLBACKURL);
  smsParams.put("Body", "Token : " + token);
  sms = smsFactory.create(smsParams);

Twilio 应该向回调 URL 发出具有 SMS 消息状态的请求。

您能否通过将回调 URL 设置为可以检查传入 HTTP 请求(例如 http://uncurler.heroku.com/和发送测试短信)的站点来验证回调 URL 实际上没有被命中?然后刷新 Uncurler 上的示例页面并查找入站 HTTP 请求。

另一种可能性是您的出站 SMS 消息被拒绝,因此 Twilio 永远不会将消息排队等待传递。检查 smsFactory.create() 行引发的异常,并检查那里的错误消息。

最新更新