【问题标题】:cant send a Generic Template from messenger api (facebook)无法从 messenger api (facebook) 发送通用模板
【发布时间】:2017-01-06 17:40:26
【问题描述】:

我正在开发一个带有 Messenger facebook 的聊天机器人,我已经有了问候文本、一个菜单(还没有工作)和一个开始按钮,当我尝试测试接收一个通用模板时,它根本什么都不做,如果我改变响应,一个简单的文本,它响应该文本,但不是通用模板,我从这里复制示例:https://developers.facebook.com/docs/messenger-platform/thread-settings

我不知道为什么无法获取通用模板,如果我配置为响应图像、按钮、文本,所有这些都已发送,但模板没有,这就是我配置响应的方式:

$response = '{
  "recipient":{
    "id":"'.$senderId.'"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"generic",
        "elements":[
           {
            "title":"Sin saber, vivió casi un mes entre muertos",
            "image_url":"https://diario.mx/imagesnotas/2017/01/LOC1307270af08088b_0.jpg",
            "subtitle":"Desde el lunes empezó a hacer oración para el descanso de las almas torturadas y sepultadas, afirma",
            "default_action": {
              "type": "web_url",
              "url": "https://diario.mx/Local/2017-01-05_f62a689b/sin-saber-vivio-casi-un-mes-entre-muertos/",
              "messenger_extensions": true,
              "webview_height_ratio": "tall",
              "fallback_url": "https://diario.mx/"
            } ,
            "buttons":[
              {
                "type":"web_url",
                "url":"https://diario.mx/",
                "title":"Ir a diario.mx"
              },{
                "type":"postback",
                "title":"Start Chatting",
                "payload":"DEVELOPER_DEFINED_PAYLOAD"
              }              
            ]      
          }
        ]
      }
    }
  }
}';

由 quick_replies 选项中的自定义有效负载“masleidas”触发

【问题讨论】:

    标签: facebook templates generics messenger chatbot


    【解决方案1】:

    根据 docs subtitle 的字符限制为 80 个,您的示例在 subtitle 中显示 99 个字符。所以我觉得字符太多了。

    您是否收到从 FB API 返回到您的聊天机器人的任何错误?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-23
      • 2017-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多