node.js - 如何使用节点 js 使用 botbulilder webex 适配器将 MS Bot 与 Webex 团队集成
问题描述
我正在尝试使用 botbuilder webex 适配器将在节点 js 中开发的 MS Bot 与 webex 团队集成,如下所示
//creating webex adapter for bot channel
const adapter = new WebexAdapter({
access_token: process.env.ACCESS_TOKEN,
public_address: process.env.PUBLIC_ADDRESS,
secret: process.env.SECRET });
尝试运行时,我收到此警告 消息 需要一些解决方案。
解决方案
您收到此错误是因为标题中的签名与您的秘密哈希不匹配。这是引发此错误的代码的相关部分。
if (this.options.secret) {
const signature = req.headers['x-spark-signature'];
const hash = crypto.createHmac('sha1', this.options.secret).update(JSON.stringify(payload)).digest('hex');
if (signature !== hash) {
console.warn('WARNING: Webhook received message with invalid signature. Potential malicious behavior!');
return false;
}
}
您需要检查请求标头中的签名是否正确,并且您在机器人选项中设置了正确的密码。
Github 上的参考资料:https ://github.com/howdyai/botkit/blob/master/packages/botbuilder-adapter-webex/src/webex_adapter.ts
推荐阅读
- node.js - MongoDB $lookup 只返回一个文档
- android - 具有受限密钥的应用程序中的谷歌地图不起作用
- javascript - 检查频道名称
- python - 在方波上检测 egde
- c++ - DRD 在 std::mutex::lock 上报告“冲突加载”错误
- java - Javafx:从文件中读取并使用 .split 方法拆分结果
- python - 为什么 Python 在 print() 输出之前将异常打印到控制台
- c - 写入的数字少于从文件中读取的数字
- reactjs - 如何对 Ant Design V2.x 表中的数据进行排序?
- ruby-on-rails - ROR 无法连接 PostgreSQL 无法连接到服务器:权限被拒绝;而控制台可以连接