Table of Contents

Dynamic Data in WhatsApp (Get Index Array selection)

Pau Sanchez Updated by Pau Sanchez

WhatsApp Dynamic Data block is not able to return the index of the selection for later use. But here is Workaround to get it.

Please use the Brick called: WhatsApp Get Index Dynamic Data v0.1

Below there is the basic structure that can be used as an example:

1. We start with the array, in this example just for educational purposes, we use a set variable with an array, but your array could be originated from other source like a Webhook block:

2. Then we continue, with a Set Variable, where we set up a value type String, it is important this block, to validate the input after. Please do not remove it:

3. Now, in the Dynamic Data block, we use the array variable and select the key that we want to display:

4. And we store the value, will be the input of the user, in the variable (type String) called @choice:

5. Due to the fact, that the user can input any character or sentence, we need to validate to do so we will check the value of @choice, with the following formula:

6. This formula has two possible outputs, True or False, if False it will send the user to insert again a valid input:

7. If is True, and the input is valid, we will generate the index value

8. And now that we have the index, we can use Formula block to extract any information we need from the array according to the selected option by the user:

How did we do?

Contact