首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >chatfuel Json api插件上的消息数组问题:仅发送文本对象,而不发送模板

chatfuel Json api插件上的消息数组问题:仅发送文本对象,而不发送模板
EN

Stack Overflow用户
提问于 2019-01-12 18:06:42
回答 1查看 239关注 0票数 0

我是聊天燃料机器人平台上的新手。

我正在使用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

代码语言:javascript
复制
{
  "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的技巧。

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2019-05-14 20:12:27

我现在正坐在沙发上,但我非常确定“附件”是消息的组成部分,而不是消息。您已经将其作为messages数组下的message对象本身。

解决方案是将它移到上面的message对象中,放在“text”之后。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54158542

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档