| ✓ Before You Begin You need an active BotSailor account with a connected WhatsApp number, an approved WhatsApp message template, a Google Sheet, and permission to use Google Apps Script. The Google Sheet should include a column namedPhone Numberbecause BotSailor needs a destination number for the WhatsApp message. Add other columns for any values you want to map into template variables. |
What Is a Webhook Workflow?
A webhook workflow allows an external application to send data to BotSailor when an event occurs. BotSailor receives the incoming data through a unique callback URL, maps the relevant fields, and uses those values in the configured automation. For the example in this guide, changes in Google Sheets trigger the webhook and BotSailor sends a WhatsApp template message using data from the changed row.
How This Example Workflow Works
- A row is inserted or edited in Google Sheets.
- Google Apps Script sends the changed row data to BotSailor's Webhook Callback URL.
- BotSailor captures the incoming webhook payload.
- The Phone Number field and template variables are mapped to the correct row values.
- BotSailor sends the selected WhatsApp message template using the mapped data.
Part 1: Create the WhatsApp Message Template
| Step 1: Open Message Templates Log in to BotSailor, select your WhatsApp bot, and go to Automation > Message Templates. Create a new message template for the notification you want to automate. |
| Step 2: Configure the Template Enter a template name and select the required locale and template category. Write the message body and add variables where Google Sheets data should appear. For example, a due-payment reminder can contain a customer-name value and a due-amount value. |
| Step 3: Save, Sync, and Confirm Approval Save the template, then sync the template status with WhatsApp. Use the template in the webhook workflow only after it is approved. NB:For meta approval message template it may take 24 hours. |
Example message template with variables that can later be mapped to Google Sheets data.
Part 2: Create the Webhook Workflow in BotSailor
| Step 1: Open Webhook Workflows From the selected WhatsApp bot, go to Automation > Webhook Workflows. Click Create to start a new workflow. |
| Step 2: Define the Workflow Enter a descriptive workflow name. Select the WhatsApp message template created in Part 1. Review the template preview to make sure the correct template is selected. |
| Step 3: Locate the Webhook Callback URL In Configure Webhook Data, BotSailor provides a unique Webhook Callback URL. This is the endpoint that Google Apps Script will call whenever the selected sheet event occurs. Keep this URL inside the workflow setup. The Google Sheet Trigger Instruction generated by BotSailor already includes the workflow-specific endpoint in the script. |
Workflow Details and Configure Webhook Data area showing the selected message template, Webhook Callback URL, Google Sheet Instruction button, and Capture Webhook Response option.
Part 3: Configure the Google Sheet Trigger
| Step 1: Prepare the Google Sheet Make sure the sheet contains a column named Phone Number. Add separate columns for values that will populate the WhatsApp template variables, such as customer name, due amount, order ID, status, or another business field. Keep the header names clear so the mapping step is easier. |
| Step 2: Open Google Sheet Trigger Instruction In the BotSailor webhook workflow, click Google Sheet Instruction. BotSailor displays the setup instructions and an Apps Script code block for the workflow. Copy the provided code rather than manually rebuilding the webhook script. |
Google Sheet Trigger Instruction panel showing the Apps Script setup steps and the workflow-specific onChange code.
| Step 3: Add the Script in Google Sheets Open the Google Sheet, then go to Extensions > Apps Script. Replace the existing function with the code copied from BotSailor. Save the Apps Script project. |
| Step 4: Create the Apps Script Trigger Open Triggers in the Apps Script editor and click Add Trigger. Choose the onChange function. Set the event source to From spreadsheet. Set the event type to On change, then save the trigger.
|
Apps Script trigger configuration using the on-change function, From spreadsheet event source, and on change event type.
| Google Authorization Notice When the Apps Script trigger is saved for the first time, Google may request account permissions. Review the requested access before continuing. If Google displays an unverified-app warning for your own Apps Script project, continue only when you recognize and trust the project you created from the BotSailor-provided script. |
| Step 5: Complete Google Authorization Select the Google account that owns or can edit the sheet. If the 'Google hasn't verified this app' screen appears for your own Apps Script project, open Advanced and select the option to continue to the project. Review the requested permissions and click Allow if they match the actions required by the script. |
Example Google unverified-app warning shown while authorizing a user-created Apps Scrip
Google permissions screen. Review the access requested by the Apps Script project before allowing it.
Part 4: Capture the Webhook Response
| Step 1: Start Capturing a Real-Time Response Return to the BotSailor webhook workflow. Click Capture Webhook Response. BotSailor will wait for a sample event so it can identify the structure of the incoming data. |
| Step 2: Trigger a Sample Sheet Event Switch to the Google Sheet and insert or edit a sample row. Use realistic sample values, including a valid phone number and values for any template variables. The Apps Script trigger sends the row data to BotSailor. |
| Step 3: Review the Incoming Raw Data After BotSailor receives the sample event, review the Raw Data panel. The payload should contain the row number, row data, and the event type such as INSERT_ROW or EDIT. Use this captured structure for the mapping step. |
Raw Data panel showing a sample webhook payload received from Google Sheets.
Part 5: Map the Webhook Data to the WhatsApp Template
| Step 1: Map the Phone Number In Webhook Response Mapping, select the incoming Google Sheet value that represents the Phone Number column. This field determines which WhatsApp number receives the message. |
| Step 2: Map the Template Variables For each variable used in the approved WhatsApp template, select the corresponding Google Sheet value from the captured webhook data. In the example screenshot, the due-amount variable is mapped to the appropriate row-data value. Use a formatter only if the incoming data needs additional formatting before it is inserted into the template. |
| Step 3: Configure an Optional Delay If required, set a delay before BotSailor sends the message after the webhook is triggered. Use 0 minutes when the message should be sent immediately. |
Webhook Response Mapping showing the Phone Number mapping, a template-variable mapping, optional formatter fields, and message delay.
Part 6: Save and Activate the Workflow
| Step 1: Save the Mapping Click Save Workflow after the mapping is complete. BotSailor confirms when the workflow data has been mapped and saved successfully. |
Success confirmation after the webhook workflow mapping is saved.
| Step 2: Confirm the Workflow Status Return to the Webhook Workflows list. Make sure the workflow is active and verified. The workflow list also provides delivery and processing information such as Targeted, Processed, Delivered, Opened, Failed, Skipped, and Last Called At. |
Webhook Workflows list showing the workflow status, verification state, delivery metrics, and last-called information.
Part 7: Test the Complete Automation
| Step 1: Add or Edit a Google Sheet Row Enter a valid Phone Number and the values needed by the template variables. Insert a new row or edit an existing row according to the trigger behavior configured in the Apps Script. |
| Step 2: Check the WhatsApp Message Confirm that BotSailor receives the webhook and sends the selected WhatsApp template to the mapped phone number. Check that each template variable contains the value from the correct Google Sheet column. |
| Step 3: Review the Workflow Report Use Workflow Report or the workflow list to check whether the event was processed, delivered, failed, skipped, or not reached. Use the Last Called At value to confirm that the workflow received the latest sheet event. |
Verification: How to Know It Worked
The workflow is working correctly when a Google Sheet change triggers the Apps Script, BotSailor receives the webhook payload, the captured row values map to the correct Phone Number and template variables, the workflow remains active and verified, and the WhatsApp template message is sent using the expected Google Sheet data.
Common Troubleshooting
| The Google Sheet change does not trigger BotSailor Confirm that the Apps Script project was saved. Check that the onChange trigger exists and uses From spreadsheet > On change. Make sure the Google account authorization was completed. |
| Capture Webhook Response does not receive sample data Click Capture Webhook Response before editing or inserting the sample row. Confirm that the script contains the workflow-specific webhook URL generated by BotSailor. Trigger another sheet change after capture mode is active. |
| The phone number or template variable is incorrect Check the Webhook Response Mapping and confirm that each field points to the correct row-data value. Make sure the Google Sheet columns are in the expected positions and contain the intended values. |
| The workflow receives data but no WhatsApp message is sent Confirm that the selected WhatsApp template is approved and still available. Check that the workflow is active and verified. Review the workflow report for Failed, Skipped, or Condition Failed results. |
Also, you can find video tutorial of configuring Webhook Workflow
Related Webhook Automation Guides
The following BotSailor guides were linked in the reference documentation and provide practical examples of webhook-based business automation:
Next Steps
- Adapt the same webhook workflow pattern for order updates, abandoned-cart recovery, COD verification, form submissions, or another system that can send webhook data.
- Create separate workflows for different message templates or business events so each workflow has clear mapping and reporting.