通过api.ai将按钮响应发送给FB Messenger [英] Sending a button response to fb messenger via api.ai

查看:89
本文介绍了通过api.ai将按钮响应发送给FB Messenger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用具有fb Messenger集成的diaglofFlow a.k.a api.ai。

I have started playing with diaglofFlow a.k.a api.ai with fb messenger integration.

我定义了一个意图,当前返回3个响应。 2个文本响应和1个自定义有效负载。

I defined an intent which current returns 3 responses. 2 text responses and 1 custom payload.

两个文本响应都很好,但是自定义有效载荷(假设返回一个按钮)就不行了。

the 2 text responses comes just fine but the custom payload which is suppose to return a button is not.

自定义有效载荷如下

{
  "recipient": {
    "id": "1234"
  },
  "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"
          }
        ]
      }
    }
  }
}

另外,请注意,接收者ID是我不确定应如何提供的东西。 fb文档说应该是收件人的号码。我不知道我将如何获得它?

Also, please note that the recipient id is something i am not sure how it should be provided. the fb documentation says it should be number of the recipient. I do not know how i am going to get that?

推荐答案

实际上是可行的

{
 "facebook": {
   "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"
      }
     ]
   }
 }
}
}

这篇关于通过api.ai将按钮响应发送给FB Messenger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆