I'm trying to edit a WhatsApp message template that includes a dropdown menu. According to the documentation, I should be able to edit the template using a POST request to the WhatsApp Message Template endpoint. However, I'm unsure how to properly structure the request body to modify the dropdown options.
Here is the request body I've tried:
API = https://graph.facebook.com/v19.0/{template_id}
{
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Bot"
},
{
"type": "BODY",
"text": "What route do you want to consult? 🚎"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "Form",
"name": "flow_path",
"children": [
{
"type": "Dropdown",
"label": "Routes",
"required": true,
"name": "Dropdown_130982",
"data-source": [
{
"id": "B101",
"title": "B101"
},
{
"id": "H20",
"title": "H20"
},
{
"id": "6",
"title": "6"
},
{
"id": "D81",
"title": "D81"
},
{
"id": "J24",
"title": "J24"
}
]
},
{
"type": "TextCaption",
"text": "Select the route you want to consult"
},
{
"type": "Footer",
"label": "Continue",
"on-click-action": {
"name": "complete",
"payload": {
"screen_0_Dropdown_0": "${form.Dropdown_130982}"
}
}
}
]
}
]
}
]
}
When I send this request, I receive an error. Can someone please provide guidance on the correct way to edit a dropdown in a WhatsApp message template?
Error:
{
"error": {
"message": "(#100) Unexpected key \"name\" on param \"components[2]['buttons'][0]\".",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AcGB-hPMI19J78vXMC8EQ5B"
}
}
I have tried editing the flow directly, but it gives an error since it only allows editing drafts. I have tried editing without the buttons and it works, but with them, it gives an error. So, the problem is in how I send the JSON when editing the buttons, but I haven't found a guide on how to do it.