【发布时间】:2017-09-09 19:09:00
【问题描述】:
当我使用 PHP curl 将此 json 数据发送到 Facebook Messenger Bot api 时,它工作正常。
$jsonData = '{ “接受者”:{ "id":"'.$sender.'" }, “信息”:{ “文本”:“'.$obj.'” } }';
但是,当我使用 FB 页面中的模板时。模板不起作用
$jsonData = '{
"recipient":{
"id":"'.$sender.'"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"generic",
"elements":[
{
"title":"Hello",
"image_url":"http://icons.iconarchive.com/icons/paomedia/small-n-flat/1024/sign-check-icon.png",
"subtitle":"Title",
"default_action": {
"type": "web_url",
"url": "https://google.com",
"messenger_extensions": true,
"webview_height_ratio": "tall",
"fallback_url": "https://google.com/"
},
"buttons":[
{
"type":"web_url",
"url":"https://google.com",
"title":"View Website"
},{
"type":"postback",
"title":"Start Chatting",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
]
}
}
}
}';
我正在尝试编码为 Json,替换按钮,没有任何反应。 Facebook 模板在 Messenger 更新后不起作用,或者我需要使用新参数?
【问题讨论】:
标签: json facebook api curl bots