You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Dialogflow富消息响应实现:Webhook返回列表结构求助

Hey there! I’ve dealt with this exact frustration before when working with Dialogflow webhooks—getting rich messages like lists to show up can feel tricky if you’re used to the basic speech/displayText structure. Let’s break down what you need to fix this.

First off, the simple speech/displayText response only handles plain text. For rich messages (lists, cards, carousels, etc.), you need to use the fulfillmentMessages field (for Dialogflow ES) or fulfillmentResponse.messages (for Dialogflow CX) instead. This is probably why the docs’ structure didn’t work for you—if you mixed up ES vs CX syntax, or didn’t nest the message correctly.

Let’s start with Dialogflow ES (the most common use case)

Here’s a working example of a webhook response that returns a list, plus a plain text fallback for platforms that don’t support rich messages:

{
  "fulfillmentText": "Here's your requested list:",
  "fulfillmentMessages": [
    // List message for Google Assistant (adjust platform for other integrations)
    {
      "listSelect": {
        "title": "My Task List",
        "items": [
          {
            "info": { "key": "task1" },
            "title": "Finish project draft",
            "description": "Due by Friday EOD"
          },
          {
            "info": { "key": "task2" },
            "title": "Schedule team sync",
            "description": "Weekly check-in on Wednesday"
          },
          {
            "info": { "key": "task3" },
            "title": "Review bug reports",
            "description": "Priority: High"
          }
        ]
      },
      "platform": "ACTIONS_ON_GOOGLE"
    },
    // Plain text fallback for platforms like Slack or generic web clients
    {
      "text": {
        "text": [
          "1. Finish project draft (Due by Friday EOD)\n2. Schedule team sync (Weekly check-in on Wednesday)\n3. Review bug reports (Priority: High)"
        ]
      }
    }
  ]
}

Key notes for ES:

  • fulfillmentText acts as a universal fallback if the platform can’t render the rich message.
  • Always specify the platform field for rich messages—different integrations (Google Assistant, Facebook Messenger, Slack) have their own supported message types. For example, Slack uses card instead of listSelect.
  • Double-check the nesting: rich message types (like listSelect) must be inside an object in the fulfillmentMessages array.

If you’re using Dialogflow CX

The structure is a bit different—you’ll use fulfillmentResponse.messages and message types like listCard:

{
  "fulfillmentResponse": {
    "messages": [
      {
        "listCard": {
          "title": "My Task List",
          "items": [
            {
              "title": "Finish project draft",
              "description": "Due by Friday EOD",
              "eventHandler": {
                "webhookHandler": "handle_task1_click"
              }
            },
            {
              "title": "Schedule team sync",
              "description": "Weekly check-in on Wednesday",
              "eventHandler": {
                "webhookHandler": "handle_task2_click"
              }
            }
          ]
        }
      }
    ]
  }
}

Why your previous attempt might have failed:

  • You used the wrong syntax for your Dialogflow version (ES vs CX).
  • You didn’t nest the rich message inside fulfillmentMessages/fulfillmentResponse.messages.
  • You forgot to specify the platform (for ES), so Dialogflow didn’t know which integration to target.
  • Your webhook wasn’t returning a valid application/json Content-Type header—this is easy to miss, but critical for Dialogflow to parse the response correctly.

Give this structure a try, and make sure to match it to your Dialogflow version. If it still doesn’t work, double-check the platform-specific message types (each integration has its own rules for rich content).

内容的提问来源于stack exchange,提问作者RoboticsNovice

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 04:12:01