我正在尝试使用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)