【问题标题】:adding facebook messenger button on ibm node-red在 ibm node-red 上添加 facebook messenger 按钮
【发布时间】:2018-01-10 07:38:24
【问题描述】:

我们在 ibm node-red 上创建了一个 ibm watson 对话工作区和 fb messenger,现在我们想在 ibm node-red 上添加 facebook messenger 按钮,这样我们就可以在 facebook messenger 上看到一些链接按钮和图片当我们问“推荐一些著名的建筑”时,任何示例代码或文档都将不胜感激

【问题讨论】:

  • follow the official facebook messenger doc: developers.facebook.com/docs/messenger-platform/send-messages/… ,我们粘贴 curl 命令并遇到以下错误: {"error":{"message":"(#100) 提供的 URL 不是信使扩展的白名单","type":"OAuthException","code":100,"e rror_subcode":2018062,"fbtrace_id":"AtdsOh0jXSU"}}

标签: json curl ibm-watson chatbot watson-conversation


【解决方案1】:

所以,正如您在Official Facebook Developer website 上看到的,您需要使用一些自定义代码。

所以在你的 POST 请求中,你需要使用:

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"<PSID>"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"button",
        "text":"What do you want to do next?",
        "buttons":[
          {
            "type":"web_url",
            "url":"https://www.messenger.com",
            "title":"Visit Messenger"
          },
          {
            ...
          },
          {...}
        ]
      }
    }
  }
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>"

此示例使用 cURL,但您可以使用任何支持 HTTP 请求的语言。 在 Node-red 中,您可以使用功能按钮添加一些自定义代码,如我上面的示例。

  • 有关如何使用buttons on Facebook Messenger 的教程。
  • Github 存储库与 IBM Watson Conversation 和 Facebook Messenger 一起使用,在 link 中有一个使用按钮的示例。

【讨论】:

    猜你喜欢
    • 2018-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-05
    相关资源
    最近更新 更多