Webhooks

Webhooks allow you to receive real-time notifications when your dashboard generation completes, eliminating the need to poll the status endpoint.

Overview

If a webhook is configured (one per user) and the request used the API key, Alloy will POST a dashboard.ready event to your webhook URL when processing completes.

Configuration

Configure your webhook URL in the Alloy dashboard. Only one webhook URL can be configured per user account.

Security: Signature Verification

All webhook requests include a signature header that you must verify to ensure the request is authentic and hasn't been tampered with.

circle-exclamation

Signature Header

The request always includes:

  • X-Alloy-Signature: HMAC SHA256 signature of the raw JSON body, using the SHA256 hash of your API key as the secret.

The secret is calculated as:

secret = sha256(b"alloy_<your_key>").hexdigest()

Webhook Payload

The webhook payload includes the following fields:

  • generation_id - The ID of the generation request

  • dashboard_id - The ID of the generated dashboard

  • dataset_id - The ID of the uploaded dataset

  • title - The dashboard title

  • share_link_id - The ID of the share link

  • share_url - The URL to view the dashboard

Example Webhook Payload

Verifying the Signature

Python Example

Node.js Example

Best Practices

1

Always verify the signature

Never process webhook requests without verifying the signature.

2

Use raw request body

Make sure you're using the raw bytes/string of the request body, not a parsed JSON object.

3

Handle errors gracefully

Return appropriate HTTP status codes (200 for success, 4xx for errors).

4

Idempotency

Your webhook handler should be idempotent, as webhooks may be retried.

5

Timeout

Respond quickly (within 5 seconds) to avoid timeouts.

Testing Webhooks

You can test your webhook endpoint using tools like:

  • https://ngrok.com/ (ngrok) - Expose local server to the internet

  • https://webhook.site/ (webhook.site) - Temporary webhook testing service

  • https://www.postman.com/ (Postman) - API testing tool

Last updated