为什么 WhatsApp Flow 模板下拉列表显示静态值,尽管动态数据集成?

问题描述 投票:0回答:1

我使用模板创建了 WhatsApp Flows,它只包含一个下拉列表,这里用户需要在下拉列表中选择人员,如果我使用 Flow Builder 中的 JSON,它就可以工作,但如果我将其更改为动态值,则不会发生任何变化它正在预览静态值(创建模板时附带的数据)

代码出了什么问题?如何修改 JSON 并应用自定义数据?

,

flow JSON

   {
          "version": "3.1",
          "screens": [
            {
              "id": "QUESTION_ONE",
              "title": "Your form",
              "data": {},
              "terminal": true,
              "layout": {
                "type": "SingleColumnLayout",
                "children": [
                  {
                    "type": "Form",
                    "name": "flow_path",
                    "children": [
                      {
                        "type": "Dropdown",
                        "label": "Person",
                        "required": true,
                        "name": "Dropdown_07042a",
                        "data-source": [
                          {
                            "id": "0_Option_1",
                            "title": "Option 1"
                          },
                          {
                            "id": "1_Option_2",
                            "title": "Option 2"
                          }
                        ]
                      },
                      {
                        "type": "Footer",
                        "label": "Continue",
                        "on-click-action": {
                          "name": "complete",
                          "payload": {
                            "screen_0_Dropdown_0": "${form.Dropdown_07042a}"
                          }
                        }
                      }
                    ]
                  }
                ]
              }
            }
          ]
        }

使用 API 请求修改(动态值)JSON

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "{{Recipient-Phone-Number}}",
    "type": "template",
    "template": {
        "name": "dynamic_drop_down",
        "language": {
            "code": "en_US"
        },
        "components": [
            {
                "type": "button",
                "sub_type": "flow",
                "index": "0",
                "parameters": [
                    {
                        "type": "action",
                        "action": {
                            "flow_token": "FLOW_TOKEN",
                            "flow_action_data": {
                                "version": "3.1",
                                "screens": [
                                    {
                                        "id": "QUESTION_ONE",
                                        "title": "Your form",
                                        "data": {
                                            "all_burgers": {
                                                "type": "array",
                                                "items": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "string"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "description": {
                                                            "type": "string"
                                                        },
                                                        "metadata": {
                                                            "type": "string"
                                                        }
                                                    }
                                                },
                                                "__example__": [
                                                    {
                                                        "id": "1",
                                                        "title": "Beef burger",
                                                        "description": "Beef, red onion relish, lettuce",
                                                        "metadata": "$9.99"
                                                    },
                                                    {
                                                        "id": "2",
                                                        "title": "Chicken burger",
                                                        "description": "Grilled chicken breast, cheese, buffalo sause",
                                                        "metadata": "$10.99"
                                                    }
                                                ]
                                            }
                                        },
                                        "terminal": true,
                                        "layout": {
                                            "type": "SingleColumnLayout",
                                            "children": [
                                                {
                                                    "type": "Form",
                                                    "name": "flow_path",
                                                    "children": [
                                                        {
                                                            "type": "Dropdown",
                                                            "label": "Person",
                                                            "required": true,
                                                            "data-source": "${data.all_burgers}",
                                                            "on-select-action": {
                                                                "name": "data_exchange",
                                                                "payload": {
                                                                    "burger": "${form.burger}"
                                                                }
                                                            }
                                                        },
                                                        {
                                                            "type": "Footer",
                                                            "label": "Continue",
                                                            "on-click-action": {
                                                                "name": "complete",
                                                                "payload": {
                                                                    "screen_0_Dropdown_0": "${form.Dropdown_07042a}"
                                                                }
                                                            }
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        ]
    }
}
whatsapp whatsapp-cloud-api whatsapp-flows
1个回答
0
投票

但是如果我将其更改为动态值,则它不会发生任何变化 预览静态值

您在这里具体改变了什么?

  • 您是否在预览部分选择了“交互式预览”,这将开始与您提供的 URL 进行数据交换。
  • 如果是,您的服务器上是否收到 API 调用,您是否看到任何错误?
© www.soinside.com 2019 - 2024. All rights reserved.