【发布时间】:2018-01-10 18:55:27
【问题描述】:
按钮被添加到信使中。当用户单击它时,会弹出“开始使用”消息。在该 Bot 从未将消息发回“开始使用”之后,什么也没有发生。没有触发 webhook。按钮仍然在同一个位置。它仅在 Messenger 页面重新加载或单击 Messenger 中的另一个聊天时才会消失。
我怎样才能让它消失并至少打开信使? 如果一般没有 webhook,我如何跟踪“GET_STARTED_PAYLOAD”?我的意思是,按钮提供的“开始使用”消息永远不会触发 webhook,而输入“开始使用”可以正常工作。
setupTheBot();
function setupTheBot(){
var button = {
"setting_type": "call_to_actions",
"thread_state": "new_thread",
"call_to_actions": [
{
"payload": "GET_STARTED_PAYLOAD"
}
]
};
request({
uri: 'https://graph.facebook.com/v2.6/me/thread_settings',
qs: { access_token: PAGE_ACCESS_TOKEN },
method: 'POST',
json: button
},
function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log("Button: Setup changed GETSTARTED_BUTTON_PAYLOAD");
console.log(body);
} else {
// TODO: Handle errors
console.log("Button: Failed. Need to handle errors.");
console.log(body);
}
});
}
我已经调查了数十个类似的问题。 尝试了不同的实现方式。结果是一样的。
使用 node.js 服务器和 ngrok 进行测试。
【问题讨论】:
标签: javascript node.js facebook facebook-messenger facebook-messenger-bot