简体   繁体   English

通用模板不起作用 - IBM Watson 和 Facebook 集成

[英]Generic templates not working - IBM Watson and Facebook integration

Currently, I am developing a DB2 database-driven IBM Watson Assistant chatbot in Facebook page, integrated with IBM Cloud Functions.目前,我正在 Facebook 页面中开发一个 DB2 数据库驱动的 IBM Watson Assistant 聊天机器人,与 IBM Cloud Functions 集成。 I have established the connection and able to send and receive messages on Facebook.我已经建立了连接并且能够在 Facebook 上发送和接收消息。

Now, I am trying to send Generic templates referencing to Facebook developer doc and implement a carousel of cards in facebook with images, titles and buttons.现在,我正在尝试发送引用Facebook 开发人员文档的通用模板,并在 facebook 中实现带有图像、标题和按钮的卡片轮播。

Things I tried: According to IBM documentation , I tried message.attachment.payload (specified in facebook developer doc) inside output.facebook in Watson JSON editor.我尝试过的事情:根据IBM 文档,我在 Watson JSON 编辑器中的output.facebook中尝试了message.attachment.payload (在 facebook 开发人员文档中指定)。

{
"output": {
"generic": [{
    "values": [{
        "text": "ok"
    }],
    "response_type": "text",
    "selection_policy": "sequential"
}],
"facebook": {
    "text": "Hi,\n\nWe have a great giveaway for you, but first we’d like for you to follow us so that you can stay updated on the latest news and trends.\n\nPlease take a moment to follow us and let me know when you've followed us by typing DONE:\n\n",
    "buttons": [{
        "url": "https://www.facebook.com/ibmcommerce/",
        "type": "web_url",
        "title": "Follow IBM Commerce",
        "messenger_extensions": "false",
        "webview_height_ratio": "full"
    }],
    "template_type": "generic"
  }
 }
}

Also, I tried implementing the solution provided in IBM Watson developer forum此外,我尝试实施IBM Watson 开发者论坛中提供的解决方案

{
  "output": {
"facebook": {
  "message": {
    "attachment": {
      "type": "template",
      "payload": {
        "text": "Hi,\n\nWe have a great giveaway for you, but first we’d like for you to follow us so that you can stay updated on the latest news and trends.\n\nPlease take a moment to follow us and let me know when you've followed us by typing DONE:\n\n",
        "buttons": [
          {
            "url": "https://www.facebook.com/ibmcommerce/",
            "type": "web_url",
            "title": "Follow IBM Commerce",
            "messenger_extensions": "false",
            "webview_height_ratio": "full"
          }
        ],
        "template_type": "button"
      }
     }
    }
   }
  }
 }

Neither of the solutions works for me.这两种解决方案都不适合我。 Kindly help me in figuring out what I am missing.请帮助我弄清楚我缺少什么。

Any help is much appreciated.任何帮助深表感谢。 Thanks in advance!提前致谢!

  1. update your webhook to an April version ( 2020-04-01 )将您的 webhook 更新到 4 月版本 ( 2020-04-01 )
  2. instead of output.facebook use output.integrations.facebook而不是output.facebook使用output.integrations.facebook

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM