I'm seeking guidance on fetching data from my custom API to dynamically populate the data-source property of a RadioButtonsGroup component within WhatsApp Flow JSON.
1

Current Approach:

I'm currently using a static data source within the RadioButtonsGroup, which is inconvenient for managing a large number of items. Every time the data changes, I need to republish the entire Flow model, which is inefficient.

Desired Outcome:

I want to integrate data from my API (https://mydomain.com/api/experience) to dynamically populate the data-source of the RadioButtonsGroup. This would eliminate the need for static data and streamline management of frequently changing items.

Samir
Chiesta circa un mese fa
Risposta selezionata
1

add in data of your first screen in flowjson

            "newusers": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "string"
                        },
                        "title": {
                            "type": "string"
                        }
                    }
                },
                "__example__": [
                    {
                        "id": "low",
                        "title": "Low"
                    }
                ]
            },

add in flow json where you want data source

  {
                            "type": "CheckboxGroup",
                            "name": "newusers",
                            "label": "Add Users:",
                            "description": "Confirm users",
                            "required": true,
                            "data-source": "${data.newusers}"
                        }

when you send flow make sure to add data using api as below

{ "messaging_product": "whatsapp", "to": "{{customer-phone-number}}", "recipient_type": "individual", "type": "interactive", "interactive": { "type": "flow", "header": { "type": "text", "text": "<HEADER_TEXT>" }, "body": { "text": "<BODY_TEXT>" }, "footer": { "text": "<FOOTER_TEXT>" }, "action": { "name": "flow", "parameters": { "flow_message_version": "3", "flow_action": "navigate", "flow_token": "<FLOW_TOKEN>", "flow_id": "{{flow-id}}", "flow_cta": "Open Flow!", "flow_action_payload": { "screen": "<SCREEN_ID>", "data": { "newusers" : [{"id" :" abc "}, {"title" : "ram" },{ "id":"xyz" , "title":"sham"}] } } } } } }

23 settembre alle ore 03:07
Ashish