无法为 Messenger 机器人设置问候语
Unable to set greeting text for Messenger bots
我正在尝试为我的 Messenger bot like this:
之一设置问候语
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"Greeting"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
以及like this:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Timeless apparel for the masses."
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
此外,我页面的消息设置
也是如此
Messenger 正确显示“开始”按钮:
但是机器人上没有问候之类的东西
除了page access token
之外还有什么问题
我不知道你到底需要什么。但是,让我猜你想要的是一旦有人点击“开始”按钮,Messenger 机器人就会向用户发送类似 "Welcome to the Bot! I wanna help you with xxx" 的内容,对吧?
首先,您需要设置“开始”按钮回发。
curl -X POST -H "Content-Type: application/json" -d '{
"get_started": {"payload": "<postback_payload>"}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>"
除了使用 curl 与服务器通信外,您还需要通过在文件中编写代码来处理“入门”按钮回发 app.js。
switch (payload) {
case 'get_started':
sendGetStarted(senderID);
break;
default:
sendTextMessage(senderID, "Postback called");
}
有关更多信息,请查看 https://messenger.fb.com/developers/tutorials/setting-up-the-welcome-screen/
上的文档
我正在尝试为我的 Messenger bot like this:
之一设置问候语curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"Greeting"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
以及like this:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Timeless apparel for the masses."
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
此外,我页面的消息设置
也是如此Messenger 正确显示“开始”按钮:
但是机器人上没有问候之类的东西
除了page access token
之外还有什么问题我不知道你到底需要什么。但是,让我猜你想要的是一旦有人点击“开始”按钮,Messenger 机器人就会向用户发送类似 "Welcome to the Bot! I wanna help you with xxx" 的内容,对吧?
首先,您需要设置“开始”按钮回发。
curl -X POST -H "Content-Type: application/json" -d '{
"get_started": {"payload": "<postback_payload>"}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>"
除了使用 curl 与服务器通信外,您还需要通过在文件中编写代码来处理“入门”按钮回发 app.js。
switch (payload) {
case 'get_started':
sendGetStarted(senderID);
break;
default:
sendTextMessage(senderID, "Postback called");
}
有关更多信息,请查看 https://messenger.fb.com/developers/tutorials/setting-up-the-welcome-screen/
上的文档