我是聊天燃料机器人平台上的新手。
我正在使用json api插件(由文档https://docs.chatfuel.com/api/json-api/json-api提供)
在我的后台,我为插件生成了下面的json响应,这是我的后台网址:http://185.206.145.26:12223/latestnews?locale=en_US&first%20name=John
{
"messages": [
{
"text": "Hi Fety! There are the latest news"
},
{
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"image_url": "http://scd.rfi.fr/sites/filesrfi/imagecache/rfi_43_medium/sites/images.rfi.fr/files/aef_image/2019-01-11t145823z_1912744290_rc1428cade00_rtrmadp_3_sudan-protests_0.jpg",
"title": "Soudan: les manifestations se poursuivent, la répression aussi",
"subtitle": "www.rfi.fr, 2019-01-12 04:03",
"buttons": [
{
"type": "web_url",
"url": "http://www.rfi.fr/afrique/20190112-soudan-manifestations-poursuivent-repression",
"title": "VOIR L'ARTICLE"
}
]
},
{
"image_url": "http://scd.rfi.fr/sites/filesrfi/imagecache/rfi_43_medium/sites/images.rfi.fr/files/aef_image/2019-01-11t182406z_855534608_rc1a370ea010_rtrmadp_3_usa-shutdown-lawsuit_0.jpg",
"title": "[Reportage] «Shutdown»: un quotidien compliqué pour des milliers d'employés",
"subtitle": "www.rfi.fr, 2019-01-12 04:01",
"buttons": [
{
"type": "web_url",
"url": "http://www.rfi.fr/ameriques/20190112-reportage-shutdown-quotidien-complique-800000-employes",
"title": "VOIR L'ARTICLE"
}
]
}
]
}
}
}
]
}问题是,当我从块调用这个api时,只发送了文本对象,而不是附件的情况。我确信我的json结构是正确的,但我必须错过一些关于chatfuel的技巧。
谢谢!
发布于 2019-05-14 20:12:27
我现在正坐在沙发上,但我非常确定“附件”是消息的组成部分,而不是消息。您已经将其作为messages数组下的message对象本身。
解决方案是将它移到上面的message对象中,放在“text”之后。
https://stackoverflow.com/questions/54158542
复制相似问题