Facebook Messenger API:发送结构化消息

Facebook Messenger API:发送结构化消息,facebook,bots,facebook-messenger,Facebook,Bots,Facebook Messenger,跟在后面的时候 我收到一个错误: \“error\”:{“message\”:“(#100)不完整的元素数据:title和至少一个其他字段(图像url、副标题或按钮)必须具有非空值\“,“type\”:“OAutheException\”,“code\”:100,“fbtrace\u id\:“ElbXaF25+0G\”} 我错过什么了吗?在我看来,所有相关字段都已存在。用ruby编写了这篇文章,在发送之前,我需要在散列上调用以_json 是的,发送前需要转换为json格式,或者是结构化消息或文

跟在后面的时候

我收到一个错误:

\“error\”:{“message\”:“(#100)不完整的元素数据:title和至少一个其他字段(图像url、副标题或按钮)必须具有非空值\“,“type\”:“OAutheException\”,“code\”:100,“fbtrace\u id\:“ElbXaF25+0G\”}


我错过什么了吗?在我看来,所有相关字段都已存在。

用ruby编写了这篇文章,在发送之前,我需要在散列上调用
以_json

是的,发送前需要转换为json格式,或者是结构化消息或文本消息

在这里查看文档时:唯一需要的是
模板类型、元素和标题
,但错误消息是至少需要一个其他字段。我也有同样的问题,你找到解决方案了吗?也可以查看这个ruby库。可能会有帮助:
messageData = {
"attachment": {
  "type": "template",
  "payload": {
    "template_type": "generic",
    "elements": [{
      "title": "First card",
      "subtitle": "Element #1 of an hscroll",
      "image_url": "http://messengerdemo.parseapp.com/img/rift.png",
      "buttons": [{
        "type": "web_url",
        "url": "https://www.messenger.com/",
        "title": "Web url"
      }, {
        "type": "postback",
        "title": "Postback",
        "payload": "Payload for first element in a generic bubble",
      }],
    },{
      "title": "Second card",
      "subtitle": "Element #2 of an hscroll",
      "image_url": "http://messengerdemo.parseapp.com/img/gearvr.png",
      "buttons": [{
        "type": "postback",
        "title": "Postback",
        "payload": "Payload for second element in a generic bubble",
      }],
    }]
  }
}