node.js - TypeError:无法读取 Nexmo API 中未定义的属性“发送”
问题描述
我正在尝试使用 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)
解决方案
推荐阅读
- css - 在伪元素上重新加载每个页面后,Z-index 会导致奇怪的重影效果
- spring-boot - 是否可以阻止创建 bean?
- sql - 过滤 MariaDB SQL 表中按 dept_name 分组的列中的值的总和
- javascript - Dymo 在 Windows 中打印空白(在 mac 中工作正常)
- sql - 如何在sql中找到小于最大的数?
- python - 用于选择目的地的简单 Python 假期脚本
- firebase - Firebase Firestore 多条件子句或云函数,带有 Flutter
- blazor-webassembly - 托管的 Blazor WASM WebRootPath 为空
- airflow - Apache Airflow 中的自定义操作员状态(排队、成功等)?
- r - 如何提取子布局以匹配 R 中的子图