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

# Webhooks

> Push form submission data to your server in real time when entries are created, updated, or paid

Webhooks let FormHug push submission data to your server the moment something happens — no polling, no manual exports. Your endpoint receives a POST request with the full entry payload within seconds of the event.

Use webhooks when the built-in integrations aren't enough and you need full control over what happens after a form is submitted. Common scenarios:

* **Sync to your own database** — a waitlist form pushes each signup directly into your backend, calculates a queue position based on referral count, and sends a personalized confirmation email
* **Trigger a workflow** — a booking form fires your internal scheduling logic the moment someone submits, rather than waiting for a nightly sync
* **Connect to any tool** — send submissions to a CRM, Slack channel, data warehouse, or any system that accepts HTTP, without being limited to pre-built integrations
* **Filter before processing** — use conditions to only fire the webhook when specific criteria are met, so your backend only receives the submissions it cares about

<img src="https://mintcdn.com/formhug-8bc4ebd1/iALiyLWJFdgRUAXP/images/integrations/form-settings-integrations-page.png?fit=max&auto=format&n=iALiyLWJFdgRUAXP&q=85&s=cc8d84753b1d9c13cc507368f90038db" alt="FormHug form settings Integrations page showing available connections" width="2930" height="1728" data-path="images/integrations/form-settings-integrations-page.png" />

## Create a Webhook

<img src="https://mintcdn.com/formhug-8bc4ebd1/fQazUszg3cFU8u2i/images/integrations/create-webhook.webp?fit=max&auto=format&n=fQazUszg3cFU8u2i&q=85&s=84d89c1f5ba5d82b4dbef632f94d700a" alt="FormHug Create Webhook dialog showing URL field, trigger events, conditions, and push fields" width="1022" height="2000" data-path="images/integrations/create-webhook.webp" />

<Steps>
  <Step title="Open form settings">
    Open your form and go to **Settings** → **Integrations**.
  </Step>

  <Step title="Add a webhook">
    Click **Add connection** and select **Webhook**.
  </Step>

  <Step title="Enter your endpoint URL">
    Paste your server's URL into the **Webhook URL** field. Click **Test** to send a sample request and verify your endpoint is reachable.
  </Step>

  <Step title="Choose trigger events">
    Check one or both events:

    * **Submission Created** — fires when a new entry is submitted
    * **Submission Updated** — fires when an existing entry is edited
  </Step>

  <Step title="Add conditions (optional)">
    Toggle **Only trigger when conditions matched** to filter which submissions fire the webhook. For example, only notify your backend when `Role` is `Founder` or `Developer`.
  </Step>

  <Step title="Review push fields">
    Expand **Push fields** to see exactly which fields and API codes will be included in the payload. All fields are pushed by default.
  </Step>

  <Step title="Create">
    Click **Create**. The webhook appears in **My connections** and starts firing immediately.
  </Step>
</Steps>

## Trigger Events

| Event           | When it fires                     |
| --------------- | --------------------------------- |
| `entry_created` | A new submission is received      |
| `entry_updated` | An existing submission is edited  |
| `entry_paid`    | A payment submission is completed |

## Payload Format

FormHug sends a `POST` request with `Content-Type: application/json`. The body follows this structure:

```json theme={null}
{
  "data": {
    "event_type": "entry_created",
    "data": {
      "form": "KPBpZA",
      "form_name": "Gen-AI Product Waitlist",
      "entry": {
        "serial_number": 42,
        "field_1": "alex@example.com",
        "field_2": "Founder",
        "field_3": "Content creation & copywriting",
        "field_4": "REF-SARAH",
        "creator_name": "Alex Chen",
        "created_at": "2025-06-09T09:23:41Z",
        "updated_at": "2025-06-09T09:23:41Z",
        "info_filling_duration": 87,
        "info_platform": "Desktop",
        "info_os": "macOS",
        "info_browser": "Chrome",
        "info_remote_ip": "203.0.113.42"
      }
    }
  }
}
```

### Entry fields

| API Code                | Field name       | Type   | Description                             |
| ----------------------- | ---------------- | ------ | --------------------------------------- |
| `serial_number`         | Serial Number    | Number | Auto-incrementing entry number          |
| `field_1` … `field_N`   | Your form fields | String | Submitted field values, in form order   |
| `creator_name`          | Submitter        | String | Name of the submitter (if collected)    |
| `created_at`            | Submitted at     | String | ISO 8601 timestamp                      |
| `updated_at`            | Modified at      | String | ISO 8601 timestamp of last edit         |
| `info_filling_duration` | Duration         | Number | Time spent filling the form, in seconds |
| `info_platform`         | Device           | String | `Desktop` or `Mobile`                   |
| `info_os`               | OS               | String | Submitter's operating system            |
| `info_browser`          | Browser          | String | Submitter's browser                     |
| `info_remote_ip`        | IP Address       | String | Submitter's IP address                  |

<Note>
  The exact API codes for your form fields (`field_1`, `field_2`, etc.) are listed in the **Push fields** table inside the webhook configuration dialog.
</Note>

## Receiving the Webhook

Your endpoint must return a `2xx` response. Here is a minimal example in Node.js:

```js theme={null}
app.post('/webhook/formhug', express.json(), (req, res) => {
  const { event_type, data } = req.body.data;
  const entry = data.entry;

  if (event_type === 'entry_created') {
    // entry.field_1 → Email
    // entry.field_2 → Role
    // entry.field_3 → Primary Use Case
    // entry.field_4 → Referral Code
    addToWaitlist(entry);
  }

  res.sendStatus(200);
});
```

<Tip>
  Respond with `200` before doing any slow work (database writes, email sends). If your endpoint times out or returns a non-2xx status, FormHug will retry the delivery.
</Tip>

## Manage Webhooks

Active webhooks appear in **My connections** on the Integrations page.

<img src="https://mintcdn.com/formhug-8bc4ebd1/fQazUszg3cFU8u2i/images/integrations/my-connections.png?fit=max&auto=format&n=fQazUszg3cFU8u2i&q=85&s=7591d8ec696df13352852f9ac45be72d" alt="My connections panel showing an active webhook with enable, edit, history, and delete controls" width="1854" height="376" data-path="images/integrations/my-connections.png" />

From there you can:

| Action                          | How                   |
| ------------------------------- | --------------------- |
| Enable / disable                | Toggle the switch     |
| Edit URL, events, or conditions | Click the pencil icon |
| View delivery history           | Click the clock icon  |
| Delete                          | Click the trash icon  |

## Related

<CardGroup cols={2}>
  <Card title="Google Sheets" icon="table" href="/docs/integrations/google-sheets">
    Sync submissions to a spreadsheet automatically
  </Card>

  <Card title="Notion" icon="book-open" href="/docs/integrations/notion">
    Create Notion database pages from form submissions
  </Card>

  <Card title="Slack" icon="slack" href="/docs/integrations/slack">
    Post submission alerts to a channel or direct message
  </Card>

  <Card title="Zapier" icon="bolt" href="/docs/integrations/zapier">
    Automate workflows across CRM, email, and productivity apps
  </Card>

  <Card title="Stripe Collect Payments" icon="credit-card" href="/docs/integrations/stripe">
    Collect payments directly inside your form
  </Card>

  <Card title="Submissions" icon="inbox" href="/docs/features/data/submissions">
    View and manage all entries in FormHug
  </Card>
</CardGroup>
