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

# Saytics Webhooks: Stream Events to Any Endpoint

> Saytics webhooks push event data to your HTTP endpoint in real time. Learn how to register a webhook, verify signatures, and handle payloads.

Saytics webhooks let you forward event data to any HTTP endpoint the moment events are tracked, enabling real-time integrations with your own systems and third-party tools.

## Use cases

* Sync Saytics events to your data warehouse
* Trigger workflows in Zapier or Make
* Update CRM records when key events fire
* Send transactional emails on specific user actions

## Registering a webhook

<Steps>
  <Step title="Open Webhooks settings">
    Go to **Settings → Webhooks**.
  </Step>

  <Step title="Add a new webhook">
    Click **Add Webhook**.
  </Step>

  <Step title="Enter your endpoint URL">
    Enter your endpoint URL. The URL must use HTTPS.
  </Step>

  <Step title="Choose which events to send">
    Choose which events to forward — either all events, or filter by event name.
  </Step>

  <Step title="Save and verify">
    Click **Save**. Saytics will send a test ping to your endpoint to confirm it is reachable.
  </Step>
</Steps>

## Webhook payload

Saytics sends a POST request to your endpoint with a JSON body for each event. Here is an example payload:

```json theme={null}
{
  "id": "evt_01HX9K2M3N4P",
  "event": "Subscription Upgraded",
  "userId": "user_456",
  "anonymousId": "anon_abc123",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "properties": {
    "plan": "pro",
    "mrr": 49.99
  },
  "context": {
    "ip": "203.0.113.1",
    "userAgent": "Mozilla/5.0..."
  }
}
```

## Verifying webhook signatures

Saytics signs every webhook request with HMAC-SHA256 so you can confirm the request came from Saytics and was not tampered with. The signature is included in the `X-Saytics-Signature` request header.

Use the following example to verify the signature in your endpoint:

```js theme={null}
const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}
```

You can find your webhook secret in **Settings → Webhooks → your endpoint → Show Secret**.

## Handling retries and responses

Your endpoint must return a `2xx` status code within 10 seconds to acknowledge receipt. If it does not, Saytics treats the delivery as failed.

<Warning>
  Saytics retries failed deliveries up to 3 times with exponential backoff. Return a 2xx status code quickly to acknowledge receipt, and process the event asynchronously if your handler needs more time.
</Warning>
