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

WhatsApp Flow端点问题:RadioButtonsGroup缺失data-source导航报错

带Endpoint的WhatsApp Flow交互视图异常问题

使用带Endpoint的WhatsApp Flow时,Flow Manager生成的JSON在预览视图显示正常,但交互视图出现错误。当前场景是每个屏幕包含选项和输入字段,第一个屏幕有三个选项,选择后结果发送至webhook,我发送的响应存在问题。已配置公私钥并提交至Graph API,可正常加解密消息。

Webhook收到的请求

{
  "version": "3.0",
  "action": "data_exchange",
  "data": {
    "product_selection": "ini_opc_1"
  },
  "flowToken": "flows-builder-5aeaa687"
}

我的Webhook响应

{
  "screen": "screen_2",
  "data": {
    "extension_message_response": {
      "params": {
        "flow_token": "flows-builder-5aeaa687"
      }
    }
  }
}

报错信息

RadioButtonsGroup 'product_selection' is missing required property "data-source".

疑问

screen2已在Flow配置中存在,为何仍要求提供products?我仅想指定WhatsApp导航至对应屏幕。

Flow的前两个屏幕配置JSON

{
   "version": "5.1",
    "data_api_version": "3.0",
    "routing_model": {
        "screen_1": [
            "screen_2"
        ],
        "screen_2": [
            "..."
        ]
    },
    "screens": [
        {
            "id": "screen_1",
            "title": "This is the screen 1",
            "data": {
                "products": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    },
                    "__example__": [
                        {
                            "id": "ini_opc_1",
                            "title": "Opt 1"
                        },
                        {
                            "id": "ini_opc_2",
                            "title": "Opt 2"
                        },
                        {
                            "id": "ini_opc_3",
                            "title": "Opt 3"
                        }
                    ]
                }
            },
            "layout": {
                "type": "SingleColumnLayout",
                "children": [
                    {
                        "type": "Form",
                        "name": "selector_form",
                        "children": [
                            {
                                "type": "RadioButtonsGroup",
                                "label": "Some welcome msg",
                                "name": "product_selection",
                                "data-source": "${data.products}",
                                "required": true
                            },
                            {
                                "type": "Footer",
                                "label": "Continuar",
                                "on-click-action": {
                                    "name": "data_exchange",
                                    "payload": {
                                        "product_selection": "${form.product_selection}"
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        },
        {
            "id": "screen_2",
            "title": "This is the screen 2",
            "data": {
                "products": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    },
                    "__example__": [
                        {
                            "id": "susc_opc_1",
                            "title": "Some opt 1"
                        },
                        {
                            "id": "susc_opc_2",
                            "title": "Some opt 2"
                        },
                        {
                            "id": "susc_opc_3",
                            "title": "Some opt 3"
                        }
                    ]
                }
            },
            "layout": {
                "type": "SingleColumnLayout",
                "children": [
                    {
                        "type": "Form",
                        "name": "selector_form",
                        "children": [
                            {
                                "type": "RadioButtonsGroup",
                                "label": "Screen 2 msg",
                                "name": "product_selection",
                                "data-source": "${data.products}",
                                "required": true
                            },
                            {
                                "type": "Footer",
                                "label": "Continuar",
                                "on-click-action": {
                                    "name": "data_exchange",
                                    "payload": {
                                        "product_selection": "${form.product_selection}"
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        }
    ]
}

问题原因及解决方法

问题出在webhook响应格式上。screen2的RadioButtonsGroup使用了${data.products}作为动态数据源,预览视图会读取配置里的__example__数据展示,但实际交互时,WhatsApp Flow需要从webhook响应的data字段中获取真实的数据源数据,否则会提示缺失data-source对应的内容。

正确的响应格式需要补充screen2所需的products数据:

{
  "screen": "screen_2",
  "data": {
    "products": [
      {
        "id": "susc_opc_1",
        "title": "Some opt 1"
      },
      {
        "id": "susc_opc_2",
        "title": "Some opt 2"
      },
      {
        "id": "susc_opc_3",
        "title": "Some opt 3"
      }
    ],
    "extension_message_response": {
      "params": {
        "flow_token": "flows-builder-5aeaa687"
      }
    }
  }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 05:44:59