nakamale
nakamale

Reputation: 31

How to fix HTTP-Status 401 (Unauthorized) on bot-connector when calling the facebook-messenger webhook?

After setting up a bot-connector (SAP Conversational AI: https://github.com/SAPConversationalAI/bot-connector), creating a channel for the fb-messenger and configuring a webhook in the fb-app i constantly get http-status 401 (unauthorized) in my bot-connector log when sending a message from my fb-messenger.

Here is what i've done so far: (i fallowed this guide: https://github.com/SAPConversationalAI/bot-connector/wiki/Channel---Messenger)

Expected results:

Actual results:

Upvotes: 3

Views: 787

Answers (1)

plieb
plieb

Reputation: 1210

When creating the channel, the app secret should be passed as the apiKey attribute and the page token as the token attribute. When the channel is created, it will have a webhookToken attribute. This should be used as the verify token when setting up the webhook on Facebook.

So instead what you should be passing to create the channel, should look like this:

{
    "slug":"channel-messenger-srtbot-dev",
    "type":"messenger",
    "token":[fb-page token],
    "apiKey":[fb-app secret],
    "isActivated":true
}

Upvotes: 0

Related Questions