Webhooks

Send your events to external URLs and receive webhooks from external services.

Outbound Webhooks

Automatically send your events to external URLs when they occur. Perfect for integrating with other tools, triggering workflows, or building custom automations.

Creating a Webhook Endpoint

Configure webhook endpoints in your dashboard to receive events at external URLs:

  1. Go to Dashboard → Webhooks
  2. Click "Create Webhook"
  3. Enter a name and destination URL
  4. Choose which events to send (or leave empty for all events)
  5. Save your webhook

Webhook Payload

Your endpoint will receive a POST request with the following payload:

{
  "id": "evt_123abc...",
  "eventName": "purchase_completed",
  "userId": "user_456",
  "sessionId": "sess_789",
  "metadata": {
    "amount": 49.99,
    "currency": "USD"
  },
  "timestamp": "2025-12-03T10:00:00.000Z",
  "projectId": "proj_xyz..."
}

Verifying Webhook Signatures

Each webhook includes an X-Serla-Signature header containing an HMAC-SHA256 signature. Verify it to ensure the webhook came from Serla:

# Test webhook verification with curl
# Your endpoint should verify the X-Serla-Signature header

curl -X POST https://your-domain.com/webhook \
  -H "Content-Type: application/json" \
  -H "X-Serla-Signature: abc123..." \
  -d '{
    "id": "evt_123",
    "eventName": "purchase_completed",
    "userId": "user_456",
    "metadata": {"amount": 49.99},
    "timestamp": "2025-12-03T10:00:00Z"
  }'

Delivery and Retries

  • Webhooks are sent immediately when events occur
  • 10-second timeout for each request
  • Your endpoint should respond with 2xx status code to indicate success
  • View delivery logs in the dashboard to debug failed requests

Incoming Webhooks

Serla also captures incoming webhooks from external services (like Stripe, GitHub, or custom APIs) so you can inspect, debug, and monitor them in real-time.

Getting Your Webhook URL

Each project has a unique webhook endpoint:

https://serla.dev/api/webhooks/receive/YOUR_PROJECT_ID

Find your project's webhook URL in the Webhooks dashboard page.

Sending Webhooks to Serla

Send webhooks to your project's endpoint with optional authentication using X-Webhook-Secret header:

curl -X POST https://serla.dev/api/webhooks/receive/YOUR_PROJECT_ID \
  -H "Content-Type: application/json" \
  -H "X-Webhook-Secret: your_webhook_secret" \
  -d '{
    "event": "payment_succeeded",
    "amount": 99.99,
    "currency": "USD",
    "customer_id": "cus_123"
  }'

Configuring Stripe Webhooks

  1. Go to your Stripe Dashboard
  2. Navigate to Developers → Webhooks
  3. Click "Add endpoint"
  4. Paste your Serla webhook URL
  5. Select the events you want to receive
  6. Save the endpoint

Configuring GitHub Webhooks

  1. Go to your GitHub repository
  2. Navigate to Settings → Webhooks
  3. Click "Add webhook"
  4. Paste your Serla webhook URL
  5. Select content type as "application/json"
  6. Choose which events trigger the webhook
  7. Save the webhook

Viewing Webhooks

Once configured, all incoming webhooks will appear in your Webhooks dashboard where you can:

  • View the complete payload in formatted JSON
  • Inspect HTTP headers sent by the service
  • See verification status for supported services
  • Filter by source (Stripe, GitHub, etc.)

Webhook Payload Structure

Serla stores the complete webhook payload as received:

{
  "id": "webhook_123",
  "source": "stripe",
  "eventType": "payment_intent.succeeded",
  "payload": {
    // The original webhook payload
  },
  "headers": {
    // HTTP headers from the request
  },
  "verified": true,
  "createdAt": "2025-12-03T10:00:00Z"
}

Pro Tip

Use Serla's webhook debugging during development to inspect payloads before implementing handlers in your production code. This helps you understand the exact structure and fields sent by external services.