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

# How to Connect a Bot Flow to External Systems in ChatSyncs

> How a bot flow calls an outside system mid-conversation, and how to send data out to Google Sheets, a CRM, or your own server automatically.

Two related ways to connect a bot flow to the outside world:

* **HTTP API** — the bot calls *out* to your own system mid-conversation and uses whatever it
  returns, e.g. an order status.
* **Outbound Actions** — ChatSyncs pushes data *out* automatically the moment something happens
  in a conversation, e.g. a form submission.

**Example (HTTP API):** A customer types their Order ID. The bot calls your Order API, gets back
`{"status": "Shipped", "tracking_id": "BD987654321"}`, and replies *"Your order has been
Shipped. Tracking ID: BD987654321"* — instantly, no human involved.

<Frame>
  <img src="https://mintcdn.com/chatsyncs/HNsP4MLygnS_qtAH/images/learn/http-api-integration/step-02-add-http-api.png?fit=max&auto=format&n=HNsP4MLygnS_qtAH&q=85&s=45854c25ebbce90a3c76ff990662477f" alt="Add HTTP API panel with endpoint, headers, and body fields" width="1127" height="489" data-path="images/learn/http-api-integration/step-02-add-http-api.png" />
</Frame>

**Where HTTP API is used:**

* Directly inside a **Keyword Replies** flow, to look something up mid-conversation.
* Inside a **WhatsApp Flow**'s **Select HTTP API** field, to send a submitted form to your
  system — see [WhatsApp Flow Forms](/learn/chatsyncs-automation/whatsapp-flow-forms-in-chatsyncs).

## Outbound Actions: send data out automatically

An **Outbound Action** sends data out of ChatSyncs the moment something happens — a subscriber
submits a form, clicks a button, or shares their location.

* Instead of that data staying locked inside ChatSyncs, it's forwarded automatically.
* Send it to Google Sheets, a CRM, your own server, Zapier, Make.com, Airtable, or any other
  place that can receive it.

<Frame>
  <img src="https://mintcdn.com/chatsyncs/KBWIuAfBOnKg9V2U/images/learn/whatsapp-outbound-actions/step-01-open-outbound-actions.png?fit=max&auto=format&n=KBWIuAfBOnKg9V2U&q=85&s=f4bceb8c1a64a7a854fa88f51ef0eb1e" alt="ChatSyncs left navigation with Chatbot Manager selected, the Automation tab highlighted, and the Outbound Actions sub-tab highlighted, showing an empty Out-bound Webhook list with a Create button" width="1260" height="528" data-path="images/learn/whatsapp-outbound-actions/step-01-open-outbound-actions.png" />
</Frame>

### Example: send Input Flow submissions to Google Sheets

Say you built a **Customer Registration Form** using an [Input Flow](/learn/chatsyncs-automation/user-input-flow-in-chatsyncs)
or [WhatsApp Flow](/learn/chatsyncs-automation/whatsapp-flows-in-chatsyncs) with fields for Full Name, Phone Number, Business
Type, Service Interested, and Demo Date. When a subscriber submits it, an Outbound Action can
push that submission straight into a Google Sheet — no manual copying, no server of your own
required. The rest of this section walks through that exact setup, since it's the most common
use case.

```
User submits WhatsApp Flow or Input Flow
            ↓
ChatSyncs Triggered
            ↓
Outbound Action
            ↓
Google Apps Script
            ↓
Google Sheet
            ↓
Columns Created Automatically
            ↓
Data Stored Automatically
```

### Set up Google Sheets as the destination

<Steps>
  <Step title="Create a Google Sheet">
    Create a new, empty Google Sheet. You don't need to add any columns — they're created
    automatically later.
  </Step>

  <Step title="Open Apps Script">
    <Frame>
      <img src="https://mintcdn.com/chatsyncs/ouLOR-saCHwHFKKf/images/learn/whatsapp-outbound-actions/step-02-open-apps-script.png?fit=max&auto=format&n=ouLOR-saCHwHFKKf&q=85&s=c787f496b220f5b3cf31b14055359141" alt="Google Sheets Extensions menu with Apps Script highlighted" width="1270" height="584" data-path="images/learn/whatsapp-outbound-actions/step-02-open-apps-script.png" />
    </Frame>

    Inside the sheet, go to **Extensions → Apps Script**.
  </Step>

  <Step title="Paste the script">
    <Frame>
      <img src="https://mintcdn.com/chatsyncs/ouLOR-saCHwHFKKf/images/learn/whatsapp-outbound-actions/step-03-paste-script.png?fit=max&auto=format&n=ouLOR-saCHwHFKKf&q=85&s=3ced2aaefe953f5838f76d87539efa46" alt="Apps Script Code.gs editor with a doPost script and the Deploy button highlighted" width="1270" height="567" data-path="images/learn/whatsapp-outbound-actions/step-03-paste-script.png" />
    </Frame>

    Delete any existing code and paste a `doPost(e)` function that reads the incoming webhook
    payload and appends it as a row — creating header columns automatically the first time
    each field name is seen:

    ```javascript theme={null}
    function doPost(e) {
      var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
      var data = JSON.parse(e.postData.contents);
      var headers = Object.keys(data);

      if (sheet.getLastRow() == 0) {
        sheet.appendRow(headers);
      }

      var values = headers.map(function(key) {
        return data[key];
      });
      sheet.appendRow(values);

      return ContentService
        .createTextOutput("Success")
        .setMimeType(ContentService.MimeType.TEXT);
    }
    ```
  </Step>

  <Step title="Deploy as a Web App">
    Click **Deploy → New deployment**, set **Select type** to **Web app**, **Execute as** to
    **Me (your Google account)**, and **Who has access** to **Anyone** (or **Anyone with the
    link**) — not **Only myself**, or ChatSyncs won't be able to reach it. Click **Deploy** and
    authorize the requested Google permissions.
  </Step>

  <Step title="Copy the Web App URL">
    <Frame>
      <img src="https://mintcdn.com/chatsyncs/ouLOR-saCHwHFKKf/images/learn/whatsapp-outbound-actions/step-05-deployment-url.png?fit=max&auto=format&n=ouLOR-saCHwHFKKf&q=85&s=32ea494ad62559168aa8cd9b42ac059d" alt="Apps Script deployment success dialog showing the Web app URL and a Copy button" width="1277" height="581" data-path="images/learn/whatsapp-outbound-actions/step-05-deployment-url.png" />
    </Frame>

    Google gives you a URL like
    `https://script.google.com/macros/s/XXXXXXXXXXXX/exec`. Copy it — this is your webhook URL.
  </Step>
</Steps>

### Create the Outbound Action in ChatSyncs

Go to **Chatbot Manager → Automation → Outbound Actions → Create**, then fill in one form covering
the webhook, its triggers, and the data it sends:

<Frame>
  <img src="https://mintcdn.com/chatsyncs/ouLOR-saCHwHFKKf/images/learn/whatsapp-outbound-actions/step-06-create-webhook-form.png?fit=max&auto=format&n=ouLOR-saCHwHFKKf&q=85&s=9d7717e9b677defd57e8f634ec775554" alt="Outbound Actions form with Webhook Name, Out-bound Webhook URL, Postback/User Input Flow/Location trigger toggles all enabled, Select Postbacks and Select Input Flows dropdowns, and data field toggles for Subscriber ID, Subscriber Name, Phone Number, Date of Birth, Location, Labels, Postback ID, and Input Flow Data" width="530" height="538" data-path="images/learn/whatsapp-outbound-actions/step-06-create-webhook-form.png" />
</Frame>

* **Webhook Name** — e.g. `Customer Registration Data`.
* **Out-bound Webhook URL** — paste the Web App URL you copied above.

**Select the trigger(s)** — Unlike separate configurations per event, **Postback**, **User Input
Flow**, and **Location** are all toggles on this same form — turn on whichever one(s) should
trigger this webhook. Whenever an enabled action happens, ChatSyncs sends the data to that
particular webhook URL:

* **Postback** — fires when a subscriber clicks a postback button. Pick which postback(s) in
  **Select Postbacks**.
* **User Input Flow** — fires when a subscriber submits an Input Flow. Pick which flow(s) in
  **Select Input Flows** (e.g. `Appointment Booking`, `Customer Registration Form`).
* **Location** — fires when a subscriber shares their live location.

You can enable more than one trigger on the same Outbound Action — each fires independently and
sends to the same configured webhook URL.

**Select fields to send** — Enable whichever fields you need: **Subscriber ID, Subscriber Name,
Phone Number, Date of Birth, Location, Labels, Postback ID, Input Flow Data**.

<Warning>
  **Turn on Input Flow Data.** Without it, the subscriber's actual form answers won't be sent —
  only metadata like the subscriber ID or name.
</Warning>

Click **Save** — the webhook is now active.

### How automatic columns work

Whenever a webhook payload arrives, the Apps Script reads its JSON keys and adds any column
that doesn't already exist — you never edit the sheet by hand. For example, a payload from a
Postback trigger like:

```json theme={null}
{
  "first_name": "Rahul",
  "chat_id": "919959623255",
  "postbackid": "73vwwaEqCBJt...",
  "reply_message_id": "wamid.HBgMOTE5..."
}
```

<Frame>
  <img src="https://mintcdn.com/chatsyncs/ouLOR-saCHwHFKKf/images/learn/whatsapp-outbound-actions/step-10-google-sheet-auto-columns.png?fit=max&auto=format&n=ouLOR-saCHwHFKKf&q=85&s=7a13913a660a348adaf13cb6f53f32b7" alt="Google Sheet with columns first_name, chat_id, postbackid, reply_message_id, wa_message_id, and whatsapp_bot_username auto-populated from a webhook payload" width="1270" height="566" data-path="images/learn/whatsapp-outbound-actions/step-10-google-sheet-auto-columns.png" />
</Frame>

produces the sheet shown above, with `first_name`, `chat_id`, `postbackid`, and
`reply_message_id` as columns, populated automatically — no manual setup per field.

If you add a new field later (e.g. `budget`), the next submission that includes it
automatically gets its own column — no need to edit the sheet first.

### Real business examples

| Use case             | Fields collected                                | Destination   |
| -------------------- | ----------------------------------------------- | ------------- |
| Lead Collection      | Name, Phone, Business Type                      | Google Sheets |
| Appointment Booking  | Name, Date, Time                                | Google Sheets |
| Property Enquiry     | Name, Phone, Property Type, Budget, Location    | Google Sheets |
| AI Automation Agency | Name, Company, Service Required, Monthly Budget | Google Sheets |

This is the simplest and most common way to connect a ChatSyncs WhatsApp Flow or Input Flow
directly to Google Sheets without running your own server — the same approach works for any
endpoint that accepts an HTTP POST, including a CRM, Zapier, Make.com, or Airtable.

### Manage Outbound Actions

<Frame>
  <img src="https://mintcdn.com/chatsyncs/KBWIuAfBOnKg9V2U/images/learn/whatsapp-outbound-actions/step-11-webhook-list-actions.png?fit=max&auto=format&n=KBWIuAfBOnKg9V2U&q=85&s=b4ff014703785c806d33a4738a03dc03" alt="Outbound Actions list with a saved Subscribe data webhook row, and its View, Edit, and Delete action icons highlighted" width="1274" height="553" data-path="images/learn/whatsapp-outbound-actions/step-11-webhook-list-actions.png" />
</Frame>

Saved webhooks appear in the **Outbound Actions** list with three actions:

* **View Report** — see webhook logs and activity, and check whether data was sent
  successfully.
* **Edit** — update the webhook URL, triggers, or selected data fields at any time.
* **Delete** — permanently remove the webhook; ChatSyncs stops sending it data immediately.

<Tip>
  Use **View Report** to confirm your Google Sheet, CRM, or server is actually receiving the
  data — don't assume it's working just because the webhook saved successfully.
</Tip>

## Frequently asked

<AccordionGroup>
  <Accordion title="Can my bot look up a customer's order status automatically?">
    Yes — connect your order API under HTTP API, map its response fields to variables, then use
    those variables in the bot's reply.
  </Accordion>

  <Accordion title="Is HTTP API the same as Outbound Actions?">
    Related but different. **Outbound Actions** push data *out* when something happens (a form
    submission, a button click). **HTTP API** is used *inside* a flow to call out and get data
    back mid-conversation.
  </Accordion>

  <Accordion title="How do I send WhatsApp form submissions to Google Sheets automatically?">
    Deploy a Google Apps Script `doPost` web app on the target sheet, copy its URL, then create
    an **Outbound Action** in Chatbot Manager → Automation with that URL, turn on **User Input
    Flow** (or **Postback** / **Location**), and make sure **Input Flow Data** is turned on.
  </Accordion>

  <Accordion title="Can I trigger the same webhook from more than one event?">
    Yes — **Postback**, **User Input Flow**, and **Location** are all toggles on the same
    Outbound Action form, not separate configurations. Enable as many as you need; each fires
    independently and sends to the same webhook URL.
  </Accordion>

  <Accordion title="Why isn't my Google Sheet receiving any data?">
    Check three things: the Apps Script deployment's **Who has access** is set to **Anyone**
    (not "Only myself"), the **Out-bound Webhook URL** in ChatSyncs exactly matches the deployed
    Web App URL, and the right trigger/fields are enabled. Use **View Report** on the webhook to
    see whether ChatSyncs is sending anything at all.
  </Accordion>

  <Accordion title="Why are my form answers missing even though the webhook fires?">
    The **Input Flow Data** field toggle is probably off. Without it, the webhook still fires
    and sends subscriber metadata, but not the actual question answers.
  </Accordion>

  <Accordion title="Do I need to manually create columns in my Google Sheet?">
    No — the Apps Script reads the JSON keys in each payload and adds any missing column
    automatically, including for new fields you start sending later.
  </Accordion>

  <Accordion title="Can I send data to something other than Google Sheets?">
    Yes — an Outbound Action sends a plain HTTP request, so any endpoint that can receive one
    works: a CRM, your own server, Zapier, Make.com, or Airtable.
  </Accordion>
</AccordionGroup>

<Warning>
  * **"Only myself" access blocks ChatSyncs entirely** — the Apps Script deployment's **Who has
    access** must be **Anyone** or **Anyone with the link**.
  * **Input Flow Data must be explicitly enabled** — it's the one field that carries the actual
    form answers; everything else is just subscriber metadata.
  * **The webhook URL must match the live deployment** — redeploying a new version in Apps
    Script can change the URL, which then needs updating in ChatSyncs too.
</Warning>
