How to give Prefilled Options in Meta Whatsapp API
1

I want to know how can we send some prefilled options in our Meta Whatsapp Template?

This is my template which contains of 1 RadioButtons and 2 Checkboxes, I made this using "flow" (survey_feedback_form) category on Meta Developers site. This takes User choices , now when user wants to update the choice, rather than sending a new list, I want to send a list with all of the choices prefilled in this template.

Any ideas how can we achieve this ?

{ "messaging_product": "whatsapp", "to": number, "type": "template", "template": { "name": "user_assistance_messages", "language": { "code": "en_US" } }
}

Awanish
Asked about 5 months ago
Selected Answer
1

You will need to do two things:

1) Make sure your Flow JSON is configured correctly with init-values (reference: https://developers.facebook.com/docs/whatsapp/flows/reference/flowjson#form-configuration)

2) When you send the template message, you can use the flow_action_data property in the message payload to set the init-values in your Flow JSON (reference: https://developers.facebook.com/docs/whatsapp/flows/gettingstarted/sendingaflow#templatemessages)

Hope this helps - if this is not 100% clear, please share your Flow JSON and I'll try to provide more specific guidance.

July 17 at 3:14 AM
Bar
Awanish

Hi, I'm sending a custom flow which have multiple Radio buttons and few checkboxes, all in different section. I want to send those with prefilled data

July 22 at 1:54 PM
Awanish

I tried sending this payload, but it didn't work

{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": number, "type": "template", "template": { "name": "template_name", "language": { "code": "en_US" }, "components": [ { "type": "button", "sub_type": "flow", "index": "0", "parameters": [ { "type": "action", "action": { "flow_token": "unused", // optional "flow_action_data": { "screen_0_RadioButtonsGroup_0": "2_Top_50_IT_Service_Providers", "screen_0_CheckboxGroup_1": [ "4_Retail", "1_Healthcare_Payors" ] } } } ] } ] } }

July 22 at 2:01 PM
Bar

When you say "it didn't work" what exactly happens?

Can you please send your Flow JSON as well so I can help debug?

July 22 at 2:41 PM
Awanish

How Can i send my flow JSON? I made it using Meta Templates, under "Blank" template section. Can we connect on some other medium? Maybe you can guide me better there.

What I'm trying to send from Postman is mentioned above

And this is response I receive from form, maybe this is what you're calling as flow JSON

{ "object": "whatsapp_business_account", "entry": [{ "id": "id", "changes": [{ "value": { "messaging_product": "whatsapp", "metadata": { "display_phone_number": "id", "phone_number_id": "id" }, "contacts": [{ "profile": {"name": "Awanish Mishra"}, "wa_id": "" }], "messages": [{ "context": { "from": "id", "id": "wamid.id==" }, "from": "", "id": "wamid.id", "timestamp": "1721116855", "type": "interactive", "interactive": { "type": "nfm_reply", "nfm_reply": { "response_json": "{\"screen_0_RadioButtonsGroup_0\":\"2_Top_50_IT_Service_Providers\",\"screen_0_CheckboxGroup_1\":[\"4_Retail\",\"1_Healthcare_Payors\"],\"flow_token\":\"unused\"}", "body": "Sent", "name": "flow" } } }] }, "field": "messages" }] }] }

July 22 at 10:34 PM