のためにも、このリンクを使用すると、nodejsを使用している場合は、要求を使用する(またはカール)グリーティングボタンを作成するために、バックポストでリッスンするようにパラメータを渡します。
let request = require('request');
request.post({
method: 'POST',
uri: `https://graph.facebook.com/v2.6/me/thread_settings?access_token=${ACCESS_TOKEN}`,
qs: {
setting_type: 'call_to_actions',
thread_state: 'new_thread',
call_to_actions: [{
payload: 'GET_START'
}]
},
json: true
}, (err, res, body) => {
// Deal with the response
});
その後、「GET_START」というポストバックを聞いて、ウェルカムメッセージを返すことができます。
request({
method: 'POST',
uri: 'https://graph.facebook.com/v2.6/me/messages',
qs: {
access_token: ACCESS_TOKEN
},
json: {
recipient: {
id: SENDER_ID
},
message: {
attachment: {
type: "template",
payload: {
template_type: "generic",
elements: {
"title": "Your Title",
"subtitle": "Welcome to my messenger bot",
"image_url": "https://mybot.example.com/images/logo.jpg"
}
}
}
}
}
}, (err, res, body) => {
// Deal with the response
});
「はじめに」[1]のドキュメントをチェックしましたか?そのようなボタンを表示するようにチャットスレッドを設定し、Get Startedボタンからコールバックを聞いてください。その後、Webhookコールの受信時にカード(画像付き)を送信します。 [1] https://developers.facebook.com/docs/messenger-platform/thread-settings/get-started-button – AndreasB
ありがとう@AndrewB私は「開始」を取得していません。ページの設定&ここのすべての手順に従ってくださいhttp://stackoverflow.com/a/36754730/1741671。助けてもらえますか? –
Hm、@Williams。私は設定の中で何も変更せずに、「開始」ボタンを含めました。単に「例」の下に送った前回のリンクで提案したデータ構造を送信します。 – AndreasB