为什么我从nexmo发送短信回拨中获得消息计数=3?

为什么我从nexmo发送短信回拨中获得消息计数=3?,nexmo,Nexmo,我使用Node.js发送短信,如下所示: const Nexmo = require('nexmo'); const nexmo = new Nexmo({ apiKey: process.env.NEXMO_API_KEY, apiSecret: process.env.NEXMO_API_SECRET }); const opts = { 'type': 'unicode' }; function sendSMS(to, content) { nexm

我使用Node.js发送短信,如下所示:

const Nexmo = require('nexmo');

const nexmo = new Nexmo({
    apiKey: process.env.NEXMO_API_KEY,
    apiSecret: process.env.NEXMO_API_SECRET
});

const opts = {
    'type': 'unicode'
};

function sendSMS(to, content) {

    nexmo.message.sendSms('qwe, to, content, opts, (err, data) => {
        if (err) return console.error(err);
        console.log('Data: ', data);
    })
}
  {
   "message-count":"3",
   "messages":[
      {
         "to":"380967547714",
         "message-id":"0C000000E412D0DB",
         "status":"0",
         "remaining-balance":"238.91280000",
         "message-price":"0.07300000",
         "network":"25503"
      },
      {
         "to":"380967547714",
         "message-id":"0C000000E412D0DC",
         "status":"0",
         "remaining-balance":"238.91280000",
         "message-price":"0.07300000",
         "network":"25503"
      },
      {
         "to":"380967547714",
         "message-id":"0C000000E412D0DD",
         "status":"0",
         "remaining-balance":"238.91280000",
         "message-price":"0.07300000",
         "network":"25503"
      }
   ]
}
输入回调数据后,我得到如下响应:

const Nexmo = require('nexmo');

const nexmo = new Nexmo({
    apiKey: process.env.NEXMO_API_KEY,
    apiSecret: process.env.NEXMO_API_SECRET
});

const opts = {
    'type': 'unicode'
};

function sendSMS(to, content) {

    nexmo.message.sendSms('qwe, to, content, opts, (err, data) => {
        if (err) return console.error(err);
        console.log('Data: ', data);
    })
}
  {
   "message-count":"3",
   "messages":[
      {
         "to":"380967547714",
         "message-id":"0C000000E412D0DB",
         "status":"0",
         "remaining-balance":"238.91280000",
         "message-price":"0.07300000",
         "network":"25503"
      },
      {
         "to":"380967547714",
         "message-id":"0C000000E412D0DC",
         "status":"0",
         "remaining-balance":"238.91280000",
         "message-price":"0.07300000",
         "network":"25503"
      },
      {
         "to":"380967547714",
         "message-id":"0C000000E412D0DD",
         "status":"0",
         "remaining-balance":"238.91280000",
         "message-price":"0.07300000",
         "network":"25503"
      }
   ]
}
我有一个合理的问题:为什么我会得到“消息计数”:3?
结果我得到了3个webhook。它应该是这样工作的吗?

我可以看到您正在发送Unicode消息。Unicode内容允许的最大长度为70个字符,而“普通”文本消息最多允许160个字符

当单个短信正文超过70个字符时,短信将被拆分为多个部分,然后在手机级别进行重构

这就是为什么您会收到多个针对已发送消息的webhook调用


如果您以“普通”文本短信息而不是Unicode类型发送消息,那么一条短信息就有160个字符。

谢谢您的快速回复。我是否需要跟踪所有回调(或messageID)以显示站点上SMS的状态?@Vasilii我只需要检查第一部分即可查看传递状态。由于这三个部分在理论上仍然属于同一条短信,只是因为它是分开发送的。但是,我建议保留所有消息ID,以防以后需要解决任何问题。