dialogflow facebook信使卡传递标题

时间:2018-05-11 21:24:48

标签: chatbot dialogflow messenger

我正在使用dialogflow并使用fb messenger作为频道。我正在使用的响应类型是卡。

我所看到的是,当用户点击按钮时,它会发送按钮标题而不是回发文本。

预计还是错误?

诊断信息看起来像

{
  "responseId": "8c263e39-5159-4f24-913f-e558b35e4dde",
  "queryResult": {
    "queryText": "contains egg",
    "action": "CakeOrder.CakeOrder-custom",
    "parameters": {
      "CakeType": "Contains Egg"
    },
    "allRequiredParamsPresent": true,
    "fulfillmentText": "choose a cake flavor",
    "fulfillmentMessages": [
      {
        "card": {
          "title": "Vanilla",
          "imageUri": "http://homecookingadventure.com/images/recipes/caramel_mirror_cake_main.jpg",
          "buttons": [
            {
              "text": "Customize",
              "postback": "vanilla"
            }
          ]
        },
        "platform": "FACEBOOK"
      },
      {
        "card": {
          "title": "Chocolate",
          "imageUri": "https://food.fnr.sndimg.com/content/dam/images/food/fullset/2012/12/20/0/FNM_010113-Smores-Cake-Recipe_s4x3.jpg.rend.hgtvcom.616.462.suffix/1371611980872.jpeg",
          "buttons": [
            {
              "text": "Customize",
              "postback": "chocolate"
            }
          ]
        },
        "platform": "FACEBOOK"
      },
      {
        "text": {
          "text": [
            "choose a cake flavor"
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "projects/doodlesbot/agent/sessions/1c33ba93-6b0b-4346-b20d-398400c4273c/contexts/cakeorder-caketype-followup",
        "lifespanCount": 2,
        "parameters": {
          "CakeType.original": "contains egg",
          "CakeType": "Contains Egg"
        }
      },
      {
        "name": "projects/doodlesbot/agent/sessions/1c33ba93-6b0b-4346-b20d-398400c4273c/contexts/cakeorder-followup",
        "lifespanCount": 1,
        "parameters": {
          "CakeType.original": "contains egg",
          "CakeType": "Contains Egg"
        }
      }
    ],
    "intent": {
      "name": "projects/doodlesbot/agent/intents/f0ba9fbd-0ac6-4683-b304-c61c44afd75a",
      "displayName": "CakeOrder - CakeType"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {},
    "languageCode": "en"
  }
}

1 个答案:

答案 0 :(得分:1)

我认为您已找到答案,但回发是供后端开发人员处理的。这实际上不是用户以文本形式发送回的内容。

快速答复的标题是您的有效载荷,换句话说,用户实际作为答复发送的内容。您可以使用有效负载来帮助区分用户选择哪个选项,然后执行某些任务,例如重定向到另一个意图或进行后续响应。