我在js中構建了我的第一個messenger bot,並且已經可以接收和回覆郵件併發送帶有選項的卡片,但是我已經嘗試了所有設置一個開始按鈕但沒有成功...這是我所做的:Facebook messenger bot入門按鈕
我不知道我做錯了什麼或我在哪裏必須調用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-開始-button.json:
{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"action?POSTBACKHERE"
}
]
}