我使用模板创建了 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}"
}
}
}
]
}
]
}
}
]
}
}
}
]
}
]
}
}