1

I've create a bot with the bot framework of microsoft. I've deployed it on Microsoft Azure and i can use it in Microsoft Teams. Now i would like to integrate it to Facebook Workplace. I've followed the procedure exposed in the Microsoft Documentation, the bot is installed and run. But when i'm trying to speak with it in the workspace interface i get this error : see the error detailed screenshot

Error: Invalid signature on incoming request

As you can see the message is received by the bot but can't be treated.

Here is more specifically the piece of code that throw this error : Problematic code

I can't explain it because if i've anderstood what i red in the forums and documentations, the problem is that the requests aren't signed correctly but they're coming directly from facebook.

So you know what is the architecture of my project here is the package.json file :

{
    "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"
    }
}

If anyone have seen this before or have ANY idea or suggestion, you're welcome, i'm completely uot of ideas ...

2 Answers2

0

I used to have the same issue and the reason for it is the secretparameter. I did some research and I saw one issue in Botkit repo, the suggestion there are:

Verify that the app_secret parameter is correct and matches the one displayed on the Settings > Basic page in the Facebook developer portal

If you are migrating from the ABS channel service, note that once you do, you will no longer be able to connect the Bot Framework emulator to your bot app. Connecting with the Emulator will cause invalid signature warnings.

The first one works for me, hope this help you as well.

Reference: https://github.com/howdyai/botkit/issues/1696 Similar post: Getting Invalid signature on incoming request with botBuilder adapter for Facebook

Yutong Tie
  • 468
  • 2
  • 9
0

Facebook doesn't accept the Microsoft Azure integration anymore, so you have to configure yourself the facebook integration to the bot hosting. You also have to pass in environment variables :

  • FACEBOOK_VERIFY_TOKEN
  • FACEBOOK_APP_SECRET
  • FACEBOOK_ACCESS_TOKEN