【发布时间】:2017-06-07 11:35:25
【问题描述】:
我正在用 js 构建我的第一个 Messenger 机器人,并且已经可以接收和回复消息并发送带有选项的卡片,但我已经尝试了一切设置开始按钮但没有成功...这是什么我已经这样做了:
我不知道我做错了什么或者我必须在哪里调用 facebookthreadAPI 函数。需要建议。
摘自 index.js:
function facebookThreadAPI(jsonFile, cmd){
// Start the request
request({
url: 'https://graph.facebook.com/v2.6/me/thread_settings?access_token='+process.env.token,
method: 'POST',
headers: {'Content-Type': 'application/json'},
form: require(jsonFile)
},
function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log(cmd+": Updated.");
console.log(body);
} else {
// TODO: Handle errors
console.log(cmd+": Failed. Need to handle errors.");
console.log(body);
}
});}
摘自 fb-get-started-button.json:
{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"action?POSTBACKHERE"
}
]
}
【问题讨论】:
标签: javascript facebook bots