私は最初のメッセンジャーボットをjsに構築しています。すでにメッセージを受信して返信したり、オプションでカードを送信したりできますが、 ...これは私がそれをしたものです:Facebookのメッセンジャーボット開始ボタン
私は間違っているか、どこでfacebookthreadAPI関数を呼び出さなければならないのか分かりません。アドバイスが必要です。 index.jsから
抜粋:FB-GET-開始-button.jsonから
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);
}
});}
を抜粋:
{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"action?POSTBACKHERE"
}
]
}