Chat with us
Knowledgebase/WhatsApp Automation/Article

How to Automate WhatsApp Business Workflows Using Webhooks in BotSailor

  • 10 Sep 2026
  • 9 min read
  • 0 views
TL;DR:
BotSailor Webhook Workflows can receive data from an external source and use that data to automatically send a WhatsApp template message. In this guide, the practical example is Google Sheets → Apps Script → BotSailor Webhook Workflow → WhatsApp Message.You will create an approved template, create a webhook workflow, configure the Google Sheet trigger, capture a sample webhook response, map the incoming fields, save the workflow, and test it.



✓ 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.

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.

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.

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 onChange function, From spreadsheet event source, and On change event type.

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

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.

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

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.

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.

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.

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.


Siddhartha Ghosh

Siddhartha Ghosh

FAQ

Frequently Asked Questions

Find answers to common questions about this topic

You can send WhatsApp messages from Google Sheets by connecting the sheet to a BotSailor Webhook Workflow. A Google Apps Script trigger sends row data to BotSailor when a row is inserted or edited. BotSailor then maps the phone number and template variables and sends the selected WhatsApp template message.

In BotSailor, create a Webhook Workflow and select an approved WhatsApp message template. Then use the provided Google Sheet Trigger Instruction to add the Apps Script to your Google Sheet. Configure the onChange trigger so changes in the sheet can send data to BotSailor and trigger a WhatsApp message.

Create a WhatsApp template in BotSailor, set up a Webhook Workflow, and connect it to Google Sheets using the provided Apps Script. When the configured sheet event occurs, the script sends the row data to BotSailor, which uses the mapped values to automatically send the WhatsApp template message.

A webhook allows an external application to send data to BotSailor when an event occurs. BotSailor receives the data through a unique callback URL, captures the incoming payload, maps the required fields, and uses those values in the configured WhatsApp automation

In BotSailor, create a Webhook Workflow, select an approved WhatsApp template, and connect an external data source to the workflow's callback URL. After BotSailor receives the webhook data, map the phone number and template variables, save the workflow, and activate it.

For the workflow described in this guide, BotSailor provides a Google Sheet Trigger Instruction containing the required Apps Script. Copy the script into Google Sheets → Extensions → Apps Script, save it, and create an onChange trigger using From spreadsheet → On change.

Copy the Apps Script generated by BotSailor into the Apps Script editor for your Google Sheet. Save the project and create an onChange trigger. When the configured sheet event occurs, the script sends the changed row data to BotSailor's workflow-specific webhook URL.

Add or edit a row in the connected Google Sheet according to the trigger behavior configured in Apps Script. The sheet should contain a valid Phone Number and the values required by the WhatsApp template. The Apps Script sends the row data to BotSailor, which then sends the configured message.

First, click Capture Webhook Response and trigger a sample event from Google Sheets. After BotSailor receives the sample payload, open Webhook Response Mapping and map the incoming Phone Number field and each template variable to the correct Google Sheet row value.

Make sure Capture Webhook Response is active before triggering the sample event. Also confirm that the Apps Script contains the correct workflow-specific webhook URL, that the script is saved, and that the Google Sheet trigger and authorization have been configured successful