Skip to main content

Webhooks Guide

Set up webhook endpoints to receive immediate notifications when Meter detects content changes.

Overview

Webhooks allow Meter to push change notifications to your application in real-time, eliminating the need for polling. Use webhooks when:
  • Changes need immediate action
  • Building event-driven systems
  • Triggering downstream workflows
Use pull-based instead when:
  • Batch processing changes
  • Webhooks aren’t feasible (firewall, no public endpoint)
  • Prefer manual control over timing

How it works

Webhook types

Meter supports four webhook formats: The webhook type is auto-detected from the URL: You can also set it explicitly:

Webhook payload

Meter sends a POST request for both successful and failed jobs. Success payload:
delivery_reason distinguishes the initial backfill (first_run) from change-driven deliveries (content_changed). Use it to skip notifying end-users on the very first run for a new schedule.
Failure payload:
The metadata field contains your custom JSON from webhook_metadata — it’s included in every payload so you can identify which project or environment the webhook belongs to. See Webhook payload formats for full field documentation.

Webhook metadata

Attach custom JSON data to every webhook payload. This is useful for routing, tagging, or identifying which schedule triggered the webhook:
Your webhook handler can then use this metadata for routing:

Webhook secrets

Webhook secrets let you verify that incoming requests are from Meter, not a third party.

How it works

  1. When you create a schedule with a webhook_url, Meter auto-generates a secret with a whsec_ prefix
  2. Every webhook request includes the secret in the X-Webhook-Secret header
  3. Your endpoint verifies the header matches your stored secret

Storing the secret

The secret is returned once when the schedule is created. Store it securely:
You can also provide your own secret:

Verifying requests

Check the X-Webhook-Secret header in your webhook handler:

Regenerating secrets

If a secret is compromised, regenerate it:
The old secret is immediately invalidated. Update your webhook handler before the next delivery.

Retry behavior

Meter automatically retries failed webhook deliveries with exponential backoff: Retry rules:
  • 2xx response: Delivery successful, no retry
  • 4xx response (client error): Delivery stops immediately — no retries. Fix your endpoint and the next scheduled job will deliver normally
  • 5xx response (server error): Retries with backoff
  • Timeout (>30 seconds): Retries with backoff
  • Connection failure: Retries with backoff
Return 200 OK as quickly as possible. Process the payload asynchronously in a background task to avoid timeouts.

Implementation

Step 1: Create a webhook endpoint

Step 2: Make endpoint publicly accessible

Options:
  • Deploy to cloud (AWS Lambda, Google Cloud Functions, etc.)
  • Use ngrok for local development: ngrok http 3000
  • Use a VPS with public IP

Step 3: Create schedule with webhook URL

Slack webhooks

Send notifications directly to Slack channels using incoming webhooks:
Slack payloads are automatically formatted as readable messages with item counts and a preview of results.

Slack Workflow webhooks

Trigger Slack Workflow Builder automations with scrape results. Use this when you’ve built a workflow in Slack’s Workflow Builder and want Meter to trigger it.
Slack Workflow webhooks do not require a webhook secret. The URL itself serves as the authentication mechanism.

Discord webhooks

Send formatted notifications to Discord channels:
Discord payloads are formatted as embeds with item counts and a preview of results.
Discord webhooks do not require a webhook secret. Discord authenticates via the webhook URL.

Best practices

1. Respond quickly

Return 200 OK within 30 seconds. Process payloads asynchronously:

2. Handle duplicates

Make processing idempotent using the job_id:

3. Handle failures gracefully

Testing webhooks

Local testing with ngrok

Testing with webhook.site

  1. Go to https://webhook.site
  2. Copy the unique URL
  3. Use it in your Meter schedule
  4. Trigger a job and view the payload on webhook.site

Test endpoint

Use the Meter test endpoint to verify delivery:

Manual testing

Troubleshooting

Solutions:
  • Verify URL is publicly accessible
  • Check endpoint returns 200 OK
  • Test with webhook.site
  • Check server logs for errors
  • Verify the schedule has a webhook_url set
Cause: Endpoint takes >30 seconds to respondSolution: Return 200 OK immediately, process asynchronously:
Cause: Retries after timeout or connection issuesSolution: Make processing idempotent using job_id:
Cause: Your endpoint returns a 4xx status codeSolution: Meter treats 4xx as a permanent failure and does not retry. Check your endpoint for:
  • Invalid webhook secret (401)
  • Incorrect URL path (404)
  • Request validation errors (422)
Fix the issue and delivery will resume on the next scheduled job.

Next steps

Need help?

Email me at mckinnon@meter.sh