TypeError:无法读取Nexmo API中未定义的属性“发送”

时间:2019-05-22 10:29:43

标签: node.js nexmo

我正在尝试使用Nexmo API发送WhatsApp消息,但它的抛出异常是未定义的发送。

const nexmo = new Nexmo({
  apiKey: apiKey,
  apiSecret: apiSecret,
  applicationId: "*************",
  privateKey: "/****/private.key"
})

nexmo.channel.send(
  { "type": "whatsapp", "number": "**********" },
  { "type": "whatsapp", "number": "************" },
  {
    "content": {
      "type": "text",
      "text": "This is a WhatsApp Message sent from the Messages API"
    }
  },
  (err, data) => { 
    if (err) {console.log(err)}
      else
      {
        console.log(data)
      }
   }
);

发送消息时出现异常...

TypeError: Cannot read property 'send' of undefined
    at Object.<anonymous> (*****/trail1.js:14:16)
    at Module._compile (module.js:652:30)


0 个答案:

没有答案