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

# Webhook and Form Integrations: Tally, Google Forms

> Send real-time webhook events from ClientX when leads are captured, or push Tally and Google Form submissions into ClientX as leads automatically.

ClientX supports outbound webhooks — so your systems are notified the moment a lead is captured — and inbound webhooks from form tools like Tally and Google Forms, so submissions flow into ClientX as leads automatically.

***

## Outbound Webhook

When ClientX captures a lead, it can POST a JSON payload to any URL you specify. Use this to trigger automations in Zapier, Make, your own backend, or any other system that accepts webhooks.

### Set Up Your Webhook

<Steps>
  <Step title="Open the Webhook integration">
    In your dashboard, go to **Integrations → Webhook**.
  </Step>

  <Step title="Enter your webhook URL">
    Paste the destination URL where ClientX should POST new lead events.
  </Step>

  <Step title="Save">
    Click **Save**. ClientX will POST to this URL on every new lead captured — from the chat widget, form integrations, or any other source.
  </Step>
</Steps>

### Example Payload

ClientX sends a JSON object with the event name and the full lead record:

```json theme={null}
{
  "event": "lead.created",
  "lead": {
    "id": "lead_abc123",
    "name": "Jane Smith",
    "email": "jane@acme.com",
    "company": "Acme Corp",
    "intent_score": 82,
    "source": "widget",
    "pages_visited": ["/pricing", "/case-studies"],
    "created_at": "2024-01-15T10:30:00Z"
  }
}
```

<Note>
  Your webhook endpoint must be reachable over the public internet. ClientX POSTs to the URL you provide on every new lead event — make sure the endpoint returns a 2xx response to confirm receipt.
</Note>

***

## Tally Forms

Turn Tally form submissions into ClientX leads automatically. ClientX extracts name, email, phone, company, and message fields from each submission and creates or updates a lead record in real time.

### Connect Tally

<Steps>
  <Step title="Open your Tally form">
    In Tally, open the form you want to connect and go to **Integrations → Webhooks**.
  </Step>

  <Step title="Add the ClientX webhook URL">
    Add the following URL as a new webhook endpoint:

    ```
    https://clientxserver-production.up.railway.app/api/forms/tally/{workspaceId}
    ```

    Replace `{workspaceId}` with your ClientX workspace ID. You can find it in **Settings → Workspace**.
  </Step>

  <Step title="Save in Tally">
    Save the webhook. Publish your form if it isn't already live.
  </Step>

  <Step title="Submissions appear as leads">
    New Tally form submissions appear in your **Leads** dashboard immediately — no manual import needed.
  </Step>
</Steps>

<Tip>
  Test your webhook by submitting your Tally form once after connecting. The lead should appear in ClientX within a few seconds.
</Tip>

<Accordion title="Optional: verify webhook signatures">
  Tally can sign webhook requests with an HMAC-SHA256 signature so you know they're genuine. To enable signature verification, go to **Settings → Workspace** in your ClientX dashboard and enter your Tally signing secret. ClientX will then validate the `tally-signature` header on every incoming request.
</Accordion>

***

## Google Forms

Capture Google Form responses as ClientX leads via webhook. Because Google Forms doesn't have a native webhook system, you connect it using Apps Script (Google's built-in automation tool) or a third-party connector like Zapier.

### Connect with Apps Script

<Steps>
  <Step title="Open your Google Form">
    In Google Forms, open the form you want to connect and click the three-dot menu → **Script editor** (or go to **Extensions → Apps Script**).
  </Step>

  <Step title="Paste the Apps Script">
    Replace any existing code with the following script, substituting your workspace ID:

    ```javascript theme={null}
    function onFormSubmit(e) {
      var form = FormApp.getActiveForm();
      var responses = e.response.getItemResponses();
      var fields = {};
      for (var i = 0; i < responses.length; i++) {
        var item = responses[i];
        fields[item.getItem().getTitle()] = item.getResponse();
      }
      UrlFetchApp.fetch(
        'https://clientxserver-production.up.railway.app/api/forms/google/{workspaceId}',
        {
          method: 'post',
          contentType: 'application/json',
          payload: JSON.stringify({
            formTitle: form.getTitle(),
            fields: fields
          }),
          muteHttpExceptions: true
        }
      );
    }
    ```
  </Step>

  <Step title="Set the trigger">
    In the Apps Script editor, go to **Triggers** (the clock icon) → **Add Trigger**. Set the function to `onFormSubmit` and the event type to **On form submit**. Save the trigger.
  </Step>

  <Step title="Responses appear as leads">
    New Google Form responses now appear in your ClientX **Leads** dashboard automatically.
  </Step>
</Steps>

### Connect with Zapier

If you prefer a no-code option, use the **Google Forms → Webhooks by Zapier** template:

<Steps>
  <Step title="Create a new Zap">
    In Zapier, create a new Zap with **Google Forms** as the trigger (event: **New Response in Spreadsheet**).
  </Step>

  <Step title="Add a Webhooks action">
    Add a **Webhooks by Zapier** action with method **POST**, URL set to your ClientX endpoint, and the form fields mapped to the request body.
  </Step>

  <Step title="Test and activate">
    Test the Zap with a sample form submission, then turn it on.
  </Step>
</Steps>

***

## Field Mapping

ClientX automatically extracts the following fields from form submissions by matching common field labels:

| Field   | Matched Labels                                        |
| ------- | ----------------------------------------------------- |
| Email   | `email`, any value containing `@`                     |
| Name    | `name`, `full name`, `first name`, `your name`        |
| Phone   | `phone`, `mobile`, `tel`                              |
| Company | `company`, `organisation`, `organization`, `business` |
| Message | `message`, `comment`, `question`, `note`              |

All other fields are stored as custom properties on the lead record.

<Note>
  Form submissions are processed as soon as they arrive. If a submission cannot be matched to any recognisable field (no email, name, or phone), it is silently dropped. Use the field labels listed above to ensure reliable extraction.
</Note>
