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)
deployed bot-connector to google cloud as app engine service to get the [bot-connector url]
created bot-connector:
- POST on [bot-connector url]/v1/connectors with body:
{"url":[bot-connector endpoint url]}
- POST-response:
{ "results": { "id": [connector id], "url": [bot-connector endpoint url], "isTyping": true, "conversations": [], "channels": [] }, "message": "Connector successfully created" }
created channel for fb-messenger:
- POST on [bot-connector url]/v1/connectors/[connector id]/channels with body:
{ "slug":"channel-messenger-srtbot-dev", "type":"messenger", "token":[fb-app secret], "apiKey":[fb-app api-key], "isActivated":true }
- POST response:
{ "results": { "id": [connector id], "updatedAt": "2019-01-22T15:03:29.569Z", "createdAt": "2019-01-22T15:03:29.569Z", "webhook": "/v1/webhook/[channel id]", "slug": [name of my channel], "type": "messenger", "token": [fb-app secret], "apiKey": [fb-app api-key], "connector": [connector id], "locales": [], "openingType": "never", "hasGetStarted": false, "forwardConversationStart": false, "isActivated": true, "isErrored": false, "webhookToken": [fb webhook token] }, "message": "Channel successfully created" }
configured fb-messenger-webhook: (after completing the config i get the http-status 200 in the bot-connector log)
- callback-url: [bot-connector url]/v1/webhook/[channel id]
- token: [fb webhook token]
subscribed webhook to my fb-page
sent a message in my fb-messenger
Expected results:
- after i send a message in the fb-messenger:
- http-status 200 in the bot-connector log
- messages gets forwarded to [bot-connector endpoint url]
- bot responds to the message (i get an answer in the fb-messenger)
Actual results:
- after i send a messag in the fb-messenger:
- http-status 401 (unauthorized) in the bot-connector log (approximately every 60 seconds after the first fb-messenger message)
- nothing else happens
- i get no answer in the fb-messenger
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: