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

# Automate Workflows by Connecting BotSmith to Zapier

> Connect BotSmith to Zapier to trigger automated workflows whenever your agent handles a conversation — forward leads to a CRM, log chats, and more.

The Zapier integration sends a JSON payload to a Zapier Webhook URL every time your BotSmith agent completes a conversation turn. Use this to automate tasks like saving leads to a CRM, sending email summaries, or logging chat events to a spreadsheet — all without writing any code.

## How It Works

Every time a user sends a message and your agent responds, BotSmith posts an event payload to the Zapier webhook URL you configure. Zapier receives the payload and triggers the Zap you've built — for example, adding a row to Google Sheets, creating a contact in a CRM, or sending a Slack alert to your sales team.

<Note>
  Webhook events are only sent when your chatbot is in **Active** status.
  Inactive chatbots do not trigger Zapier events.
</Note>

## Step 1: Set Up a Zapier Webhook Trigger

1. Sign in to [zapier.com](https://zapier.com) and click **Create Zap**.
2. For the trigger, search for and select **Webhooks by Zapier**.
3. Choose the **Catch Hook** event and click **Continue**.
4. Zapier generates a unique webhook URL for this Zap — copy it.

## Step 2: Connect to BotSmith

<Steps>
  <Step title="Open the Integrations tab">
    In the BotSmith chatbot editor, click the **Integrations** tab.
  </Step>

  <Step title="Open Zapier configuration">
    Find the **Zapier** card and click **Setup**.
  </Step>

  <Step title="Enter your webhook URL">
    In the **Webhook URL (from Zapier)** field, paste the URL you copied from Zapier. You can also add an optional **API Key** if you want BotSmith to authenticate outgoing requests.
  </Step>

  <Step title="Save the integration">
    Click **Save Integration**. BotSmith immediately begins sending events to your webhook after each conversation turn.
  </Step>

  <Step title="Enable the integration">
    Toggle **Enable Integration** on.
  </Step>
</Steps>

## Webhook Payload

Each event BotSmith sends to Zapier contains the following JSON fields:

```json theme={null}
{
  "chatbot_id": "YOUR_CHATBOT_ID",
  "chatbot_name": "My Support Bot",
  "conversation_id": "conv_abc123",
  "user_message": "I'd like to book an appointment",
  "bot_response": "Sure! Please share your preferred date and time.",
  "user_id": "visitor_001",
  "user_name": "Anonymous",
  "metadata": {}
}
```

| Field             | Description                                               |
| ----------------- | --------------------------------------------------------- |
| `chatbot_id`      | The ID of the BotSmith chatbot that responded.            |
| `chatbot_name`    | The display name of your BotSmith chatbot.                |
| `conversation_id` | Unique ID for the conversation session.                   |
| `user_message`    | The message the user sent.                                |
| `bot_response`    | The reply your agent generated.                           |
| `user_id`         | A unique identifier for the visitor (or a session ID).    |
| `user_name`       | The visitor's name if collected, otherwise `"Anonymous"`. |
| `metadata`        | Additional context attached to the message, if any.       |

Use these fields as inputs when building your Zap's action steps.

## Receiving Messages from Zapier

BotSmith also accepts incoming webhooks from Zapier, letting you send messages *to* a chatbot via a Zap and get an AI response back. To use this, configure a Zapier action with a **POST** request to:

```
POST https://YOUR_DOMAIN/api/zapier/webhook/YOUR_CHATBOT_ID
```

The request body should be JSON with at least a `message` field:

```json theme={null}
{
  "message": "What are your support hours?",
  "user_id": "crm_contact_456",
  "user_name": "Jane Smith",
  "conversation_id": "optional-thread-id"
}
```

If you configured an **API Key** when setting up the integration, include it as a request header:

```
X-API-Key: YOUR_API_KEY
```

The response includes the chatbot's reply:

```json theme={null}
{
  "success": true,
  "response": "Our support team is available Monday–Friday, 9 AM–6 PM EST.",
  "conversation_id": "optional-thread-id"
}
```

## Example Zap Workflows

Here are a few ways teams use the BotSmith + Zapier integration:

* **Log every chat to a spreadsheet** — New conversation turn → add a row to Google Sheets. Great for auditing or reviewing agent performance.
* **Capture leads in your CRM** — New conversation turn → create or update a contact in HubSpot, Salesforce, or Pipedrive. Map `user_name` and `user_message` to contact fields.
* **Alert your team in real time** — New conversation turn → post a message in Slack with the user's message and the agent's response.

You can add filters in Zapier to trigger workflows only when specific conditions are met — for example, create a lead only when `user_message` contains "pricing" or "book a demo."

## Disabling the Integration

Toggle the Zapier integration off in BotSmith at any time to stop outgoing webhook events. Your Zap remains intact while the integration is paused — no need to reconfigure Zapier when you re-enable it.
