设置了自动程序连接器(SAP会话AI:https://github.com/SAPConversationalAI/bot-connector),为fb-messenger创建通道并在fb-app中配置Webhook后,我不断获得http-status 401(未授权)的信息从fb-messenger发送消息时,出现了我的机器人连接器日志。
这是我到目前为止所做的:(我不喜欢本指南:https://github.com/SAPConversationalAI/bot-connector/wiki/Channel---Messenger)
将bot-connector部署到Google Cloud作为应用引擎服务,以获取[bot-connector url]
创建的漫游器连接器:
{"url":[bot-connector endpoint url]}
{
"results": {
"id": [connector id],
"url": [bot-connector endpoint url],
"isTyping": true,
"conversations": [],
"channels": []
},
"message": "Connector successfully created"
}
为fb-messenger创建了频道:
{
"slug":"channel-messenger-srtbot-dev",
"type":"messenger",
"token":[fb-app secret],
"apiKey":[fb-app api-key],
"isActivated":true
}
{
"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"
}
配置的fb-messenger-webhook :(完成配置后,我在bot连接器日志中获得了http状态200)
将Webhook订阅到我的fb页面
在我的fb-messenger中发送了一条消息
预期结果:
实际结果:
答案 0 :(得分:0)
在创建频道时,应将应用秘密作为apiKey属性传递,将页面令牌作为令牌属性传递。创建通道后,它将具有webhookToken属性。在Facebook上设置Webhook时,应将其用作验证令牌。
因此,您应该传递的用于创建频道的内容应如下所示:
{
"slug":"channel-messenger-srtbot-dev",
"type":"messenger",
"token":[fb-page token],
"apiKey":[fb-app secret],
"isActivated":true
}