Facebook Workplace中的BotFramework集成



我用微软的bot框架创建了一个bot。我已经在Microsoft Azure上部署了它,我可以在Microsoft Teams中使用它。现在我想把它集成到Facebook Workplace中。我已经遵循了Microsoft文档中公开的过程,机器人程序已经安装并运行。但当我试图在工作区界面中与它对话时,我会收到以下错误:请参阅错误详细截图

Error: Invalid signature on incoming request

正如你所看到的,机器人收到了消息,但无法处理。

以下是引发此错误的代码片段:问题代码

我无法解释,因为如果我在论坛和文档中找到了我想要的内容,问题是请求没有正确签名,而是直接来自facebook。

所以你知道我的项目的架构是什么,这里是package.json文件:

{
"name": "AppName",
"version": "1.0.0",
"description": "Offer an ergonomic interface between Microsoft Teams and our solution",
"author": "Generated using Microsoft Bot Builder Yeoman generator v4.7.0",
"license": "MIT",
"main": "./lib/index.js",
"scripts": {
"build": "npm run config && npm run html && tsc --build",
"lint": "tslint -c tslint.json 'src/**/*.ts'",
"postinstall": "npm run build && node ./deploymentScripts/webConfigPrep.js",
"start": "npm run build && node ./lib/index.js",
"test": "echo "Error: no test specified" && exit 1",
"watch": "nodemon --watch ./src -e ts --exec "npm run start"",
"html": "copyfiles -f src/**/*.html lib/",
"config": "copyfiles config/* lib/"
},
"repository": {
"type": "git",
"url": "https://github.com"
},
"dependencies": {
"@microsoft/teams-js": "^1.9.0",
"axios": "^0.21.1",
"botbuilder": "^4.12.0",
"botbuilder-dialogs": "^4.12.0",
"botbuilder-adapter-facebook": "^1.0.11",
"config": "^3.3.6",
"dotenv": "^8.2.0",
"replace": "^1.2.0",
"restify": "^8.5.1",
"rxjs": "^6.6.6",
"vue": "^2.6.12"
},
"devDependencies": {
"@types/restify": "8.5.1",
"copyfiles": "^2.4.1",
"nodemon": "^2.0.7",
"tslint": "^6.1.3",
"typescript": "^4.2.3"
}
}

如果有人以前看过这个,或者有任何想法或建议,不客气,我完全没有想法。。。

我曾经遇到过同样的问题,原因是secretparameter。我做了一些研究,我在Botkit回购中看到了一个问题,建议是:

验证app_secret参数是否正确,并且与"设置">Facebook开发者门户中的基本页面

如果您从ABS通道服务迁移,请注意,一旦迁移,您将无法再将Bot Framework模拟器连接到您的机器人应用程序。连接Emulator将导致无效的签名警告。

第一个对我有效,希望这对你也有帮助。

参考:https://github.com/howdyai/botkit/issues/1696类似的帖子:使用Facebook 的botBuilder适配器获取传入请求的无效签名

Facebook不再接受Microsoft Azure集成,因此您必须将Facebook集成配置为机器人托管。您还必须传入环境变量:

  • FACEBOOK_VERIFY_TOKEN
  • FACEBOOK_APP_SECRET
  • FACEBOOK_ACCESS_TOKEN

最新更新