簡體   English   中英

無法從Messenger API(facebook)發送通用模板

[英]cant send a Generic Template from messenger api (facebook)

我正在開發一個聊天機器人和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”觸發

根據docs,字幕的字符數限制為80,而您的示例在字幕中顯示了99個字符。 所以我認為字符太多。

您是否從FB API返回到聊天機器人的任何錯誤?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM