How To Fetch Data From Google Sheet And Make Dynamic Buttons / Lists In WhatsApp ?
Lets see How to Create a Bot for Mobile Number Complaint Tracking
Step 1: Preparing Google Sheet
Ensure your Google Sheet contains all necessary data for the complaints.
Step 2: Creating the Bot Flow
Start by creating a new bot flow triggered appropriately for your needs.
Ask users to confirm if their current number is their billing number.
Store the user's response in a "number" custom field.
Step 3: Fetching Data From Google Sheet
Utilize the "Google Sheet Look Up Spreadsheet Rows" action to retrieve complaint data.
Authenticate to connect to your Google Sheets.
Specify the sheet, the column for the search, and use the "number" field as the search value.
Limit the max number of complaints to fetch (e.g., 10).
Save the fetched data to construct the bot flow further.
Create bot fields for the number of rows matched and the complaint data in JSON format.
Step 4: Handling Data and Interactive Elements
Map the Google Sheets data to a "complaints search" bot field.
Set up a routing condition for "zero rows" to handle cases where no complaints are found.
If zero, notify the user via WhatsApp and prompt for the billing number again.
If more than zero, use an "ask a question" block to create dynamic buttons or a list for complaint selection.
Configure the buttons with necessary details including unique hidden values for each.
Step 5: Fetching and Displaying Complaint Status
Once a complaint number is selected, search for it in the designated Google Sheet column.
Retrieve and send the complaint status back to the user, saving it in a bot field.
Step 6: Optimizing User Experience
Include a "go to" block linking back to step six for users correctly identifying their WhatsApp number as their billing number, to streamline the process.
Step 7: Saving and Testing the Workflow
Ensure all settings are saved and the workflow is enabled.
Test the bot thoroughly to confirm it responds as expected, can fetch data correctly, and users are able to select and receive status updates on complaints.
This sequence should enable your bot to efficiently gather user complaints from a Google Sheet and interactively offer status updates via WhatsApp.
Last updated