> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatsyncs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhook Workflow

> Webhook Workflow sends a WhatsApp template message automatically whenever an external system — like a Google Sheet — calls a webhook URL. Use this when a customer wants a WhatsApp message (order update, shipping notice, reminder) triggered by a new or edited row in a spreadsheet, or any third-party system that can call a webhook.

**WhatsApp → Webhook Workflow** sends a WhatsApp template message whenever data arrives from an
outside system through a webhook call — most commonly a new or edited row in Google Sheets.
Each workflow is tied to one **WhatsApp Account** and one **Message Template**, and every field
in the incoming data can fill in that template's variables.

```
Google Sheets (row added/edited)
        │
        ▼
Apps Script trigger
        │
        ▼
ChatSyncs Webhook Callback URL
        │
        ▼
Webhook Workflow
        │
        ▼
WhatsApp Template Message Sent
```

## Prerequisite: a message template with variables

Before creating a workflow, the message template it will send needs **Template Variables** —
placeholders that get filled in from the webhook data.

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-01-message-template-variables-list.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=0f86e3da841983a5ead93cc57e5d1589" alt="Message Template settings page with a Template Variables section and a Create button" width="1265" height="526" data-path="images/learn/whatsapp-webhook-workflow/step-01-message-template-variables-list.png" />
</Frame>

<Steps>
  <Step title="Open Message Template settings">
    In **Chatbot Manager**, open **Message Template**, and scroll down to **Template Variables**.
  </Step>

  <Step title="Create a variable">
    Click **Create** and name it — no spaces allowed, e.g. `deliverydate`.

    <Frame>
      <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-02-create-template-variable.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=829842f9eb37201f59a8c6c995cd6d66" alt="Create Template Variable modal with a Variable Name field containing deliverydate" width="358" height="551" data-path="images/learn/whatsapp-webhook-workflow/step-02-create-template-variable.png" />
    </Frame>
  </Step>

  <Step title="Use the variable inside a template">
    Create or edit a message template and insert your variables into the body using
    `#!variablename!#`, alongside built-in **Custom Fields** and **Variables** like `Name`.

    <Frame>
      <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-03-message-template-with-variables.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=68b7eadc14a08f5fbec7b7e271361b8f" alt="Message Template editor with body text Total: #!totalprice!#, Delivery date: #!deliverydate!#, and a live WhatsApp preview on the right" width="884" height="538" data-path="images/learn/whatsapp-webhook-workflow/step-03-message-template-with-variables.png" />
    </Frame>

    For example, a template body of:

    ```
    Hi, Thanks for shopping with us! Here are the details of your order:

    Product: [productlist]
    Total: #!totalprice!#
    Delivery date: #!deliverydate!#
    ```
  </Step>

  <Step title="Sync the template">
    Click **Sync Template** so its approval status updates from Meta.

    <Frame>
      <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-04-sync-template.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=628ee2c052edcc8aa6da079b36868fce" alt="Message Template Settings page with a Successful banner after clicking Sync Template, and a list of templates with their approval status" width="1252" height="534" data-path="images/learn/whatsapp-webhook-workflow/step-04-sync-template.png" />
    </Frame>

    The template must show **Approved** before a workflow can send it.
  </Step>
</Steps>

## Step 1: Create the workflow

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-05-webhook-workflow-list-and-details.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=2d34bed19819c3b197f7ee3102365ee6" alt="Webhook Workflow list showing an existing order update workflow with delivery stats, and a Workflow Details form below with Workflow Name, WhatsApp Account, and Message Template fields" width="1248" height="544" data-path="images/learn/whatsapp-webhook-workflow/step-05-webhook-workflow-list-and-details.png" />
</Frame>

In **WhatsApp → Webhook Workflow**, fill in **Workflow Details**:

* **Workflow Name** — e.g. `order update`
* **WhatsApp Account** — which connected number sends the message
* **Message Template** — the approved template to send, e.g. `orderdetails`

Click **Create Workflow**. This workflow's purpose, as ChatSyncs describes it: *"Send WhatsApp
template message based on data received from 3rd party webhook call."*

## Step 2: Get the webhook URL

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-06-webhook-callback-url.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=f5b3060d37d7c7467faeec9a5bb21a87" alt="Webhook Callback URL shown after creating a workflow, with Google Sheet Trigger Instruction and Capture Webhook Response buttons" width="1260" height="534" data-path="images/learn/whatsapp-webhook-workflow/step-06-webhook-callback-url.png" />
</Frame>

ChatSyncs generates a unique **Webhook Callback URL** for this workflow, e.g.
`https://platform.chatsyncs.com/webhook/whatsapp-workflow/xxxxxxx`. Copy it — you'll paste it
into whatever system will call it (a Google Sheet's Apps Script, in this example). Each workflow
has its own URL, so a test submission or record sent to it only affects this one workflow.

## Step 3: Create your sheet's header columns first

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-08-google-sheet-headers.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=488e110d5e29c691c985392be536157f" alt="Google Sheet with header row: phone number, product list, total price, delivery date" width="1274" height="538" data-path="images/learn/whatsapp-webhook-workflow/step-08-google-sheet-headers.png" />
</Frame>

Before touching Apps Script, set up your sheet's header row to match the fields your template
needs — e.g. `phone number`, `productlist`, `price`. Each column becomes a field ChatSyncs can
map to a template variable, using either `[fieldname]` (custom field) or `#fieldname#`
(template variable) syntax depending on how it's referenced in your template.

<Warning>
  **The `phone number` column is mandatory.** Without it, ChatSyncs has no way to know which
  WhatsApp number to send the message to — every other column is optional and only needed if your
  template actually uses it.
</Warning>

## Step 4: Wire up Google Sheets

Click **Google Sheet Trigger Instruction** for the exact script to paste in:

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-07-google-sheet-trigger-instruction.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=318619459fbfe615af303fc087253995" alt="Google Sheet Trigger Instruction modal with steps to go to the Apps Script editor, add the code, set up a trigger, and test the function, plus an onChange function code sample" width="544" height="549" data-path="images/learn/whatsapp-webhook-workflow/step-07-google-sheet-trigger-instruction.png" />
</Frame>

<Steps>
  <Step title="Open Apps Script">
    In your Google Sheet, go to **Extensions → Apps Script**.
  </Step>

  <Step title="Paste the code">
    Paste in the `onChange` function ChatSyncs gives you in the instructions above — it already
    includes a `sendToWebhook` function wired to *your* workflow's webhook URL:

    <Frame>
      <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-08b-apps-script-code-pasted.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=edcb075050a5a8ace82ab1ac1f16a8bd" alt="Apps Script Code.gs editor with the full onChange and sendToWebhook functions pasted in, including the workflow's webhook URL" width="1280" height="552" data-path="images/learn/whatsapp-webhook-workflow/step-08b-apps-script-code-pasted.png" />
    </Frame>

    It detects an inserted row (`INSERT_ROW`) or an edited row (`EDIT`) and sends that row's data
    to the webhook URL.

    <Warning>
      **Press Ctrl+S to save the script before continuing.** If you skip this, the trigger you add
      next won't run the code you just pasted.
    </Warning>
  </Step>

  <Step title="Add a trigger">
    Click the **Triggers** (clock) icon, then **Add Trigger**:

    <Frame>
      <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-09-apps-script-triggers-list.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=f6ecbc30094b1b838261c2b968f1e498" alt="Apps Script Triggers page listing one trigger: function onChange, event From spreadsheet - On change" width="1258" height="524" data-path="images/learn/whatsapp-webhook-workflow/step-09-apps-script-triggers-list.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-10-add-trigger-modal.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=50b0b70dc62c8adb994c1066deb78746" alt="Add Trigger modal set to function onChange, deployment Head, event source From spreadsheet, event type On change" width="573" height="487" data-path="images/learn/whatsapp-webhook-workflow/step-10-add-trigger-modal.png" />
    </Frame>

    Set **Choose which function to run** to `onChange`, **Select event source** to
    `From spreadsheet`, and **Select event type** to `On change`. Save.
  </Step>
</Steps>

## Step 5: Test, capture, and map the fields

Add a real row of data to try it:

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-11-google-sheet-test-rows.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=0d082d82b7351cd69b9448096c100013" alt="Google Sheet with two test rows: a phone number, product, price, and delivery date for each" width="1261" height="550" data-path="images/learn/whatsapp-webhook-workflow/step-11-google-sheet-test-rows.png" />
</Frame>

The `onChange` trigger fires automatically and calls your workflow's webhook URL. Back in
ChatSyncs, click **Capture Webhook Response** so the workflow detects the incoming fields from
that test row:

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-12-capture-webhook-response.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=2969b5d1f1f091dd425e85c7ea0d9798" alt="Webhook Callback URL screen with the Capture Webhook Response button highlighted" width="1267" height="543" data-path="images/learn/whatsapp-webhook-workflow/step-12-capture-webhook-response.png" />
</Frame>

The first time you do this, ChatSyncs shows a **variable assigning / mapping** step — match each
detected sheet field (`phone number`, `productlist`, `price`, ...) to the corresponding template
variable you created earlier. Once mapped and saved, every future row sent through this webhook
fills in the template automatically using that same mapping.

## Monitoring workflows

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-13-workflow-list-report-button.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=76e4c294cad3dadb983ef28638dee5b1" alt="WhatsApp Webhook (in-bound) Workflow list with two order update workflows and their Sent, Delivered, Opened, Failed, Skipped, and Unreached stats, and a Workflow Report button" width="1256" height="544" data-path="images/learn/whatsapp-webhook-workflow/step-13-workflow-list-report-button.png" />
</Frame>

The workflow list shows **Sent**, **Delivered**, **Opened**, **Failed**, **Skipped**, and
**Unreached** counts for every workflow. Click **Workflow Report** for the full call-by-call log:

<Frame>
  <img src="https://mintcdn.com/chatsyncs/FIE0qavsa8Nzc-BK/images/learn/whatsapp-webhook-workflow/step-14-workflow-report-table.png?fit=max&auto=format&n=FIE0qavsa8Nzc-BK&q=85&s=e4be3d3d0e0f5b2068e59a2410bf75b5" alt="WhatsApp Webhook Workflow Report table with columns Phone Number, Status, Response, Triggered at, Scheduled at, Response, and Webhook Data" width="1266" height="540" data-path="images/learn/whatsapp-webhook-workflow/step-14-workflow-report-table.png" />
</Frame>

Each row shows the **Phone Number** the message went to, its **Status** (e.g. Completed),
**Response** (e.g. Success), **Triggered at** / **Scheduled at** timestamps, and the raw
**Response** and **Webhook Data** payloads — useful for confirming exactly what data a specific
row sent.

## Common use cases

* **Order confirmation** — notify a customer the moment their order row is added.
* **Shipping updates** — send tracking info after a dispatch row is logged.
* **Appointment reminders** — trigger from a bookings sheet.
* **Payment confirmation** — notify once a payment row is marked received.
* **Lead follow-up** — instantly message a new lead captured in a sheet.
* **Customer onboarding** — welcome a new row automatically.
* **Event registration** — confirm a signup with a personalized message.

## Best practices

<Warning>
  * **Always include a `phone number` column** — it's mandatory; without it ChatSyncs has no
    destination for the message.
  * **Store phone numbers in international format** (e.g. `919876543210`) — this is what the
    webhook payload and WhatsApp both expect.
  * **Save your Apps Script with Ctrl+S before adding the trigger** — an unsaved script won't run
    when the trigger fires.
  * **Keep spreadsheet column headers consistent** — the workflow maps fields by header name, so a
    renamed column breaks the mapping silently.
  * **Test with Capture Webhook Response before going live** — confirm the fields it detects match
    what you expect before relying on it for real customers.
  * **Use an approved template** — a workflow can't send a template that hasn't come back
    **Approved** from Sync Template.
  * **Check the Workflow Report regularly** — it's the fastest way to spot a spike in **Failed** or
    **Skipped** sends.
</Warning>

## Frequently asked

<AccordionGroup>
  <Accordion title="How do I send a WhatsApp message automatically when a Google Sheet row is added?">
    Create a message template with the variables you need, create a Webhook Workflow pointing at
    that template, copy its webhook URL into a Google Apps Script `onChange` trigger on your
    sheet (via **Google Sheet Trigger Instruction**), then test with **Capture Webhook Response**.
  </Accordion>

  <Accordion title="Why isn't my workflow detecting the columns from my sheet?">
    Click **Capture Webhook Response** after triggering a fresh test row — this is how ChatSyncs
    detects which fields are coming in. If it still doesn't show your columns, check that the
    Apps Script trigger is active and that the sheet's header row matches what you expect.
  </Accordion>

  <Accordion title="Can one workflow send to many different customers?">
    Yes — every row that triggers the webhook (a new row, or an edit) runs the workflow again for
    that row's phone number.
  </Accordion>

  <Accordion title="Where do I check if a specific message actually sent?">
    Open **Webhook Workflow → Workflow Report** and search by phone number — it shows the
    **Status**, **Response**, and the exact **Webhook Data** received for that send.
  </Accordion>

  <Accordion title="Does this only work with Google Sheets?">
    Google Sheets (via Apps Script) is the common case, but the webhook URL just needs an HTTP
    call with the right data — any third-party system capable of calling a webhook can trigger
    the same workflow.
  </Accordion>
</AccordionGroup>
