Setting up webhooks
This guide covers configuring webhooks to receive real-time notifications when events occur in Scalar.
What are webhooks?
Webhooks let you receive HTTP notifications when important events happen:
- A new idea is submitted
- An idea's status changes
- A survey receives a response
- An announcement is published
- A new customer signs up
When an event occurs, Scalar sends an HTTP POST request to your configured URL with event data.
Prerequisites
Webhooks require a subscription add-on. Check your plan in Settings > Billing.
Creating a webhook
- Go to Settings > Webhooks (in the API & Integrations section)
- Click Add webhook
- Enter your endpoint URL (must be HTTPS)
- (Optional) Add a description
- Select the events to subscribe to
- Click Add webhook
Available events
| Event | Description |
|---|---|
idea.created | A new idea has been submitted and approved |
idea.status_changed | An idea's status has been updated |
idea.voted | An idea has received a new upvote |
survey.response_created | A new response to a survey has been submitted |
announcement.published | A new announcement has been published |
customer.created | A new customer has been added |
customer.approved | A customer account has been approved |
You can subscribe to individual events or select All events to receive notifications for everything.
Payload format
All webhooks use this consistent structure:
{
"event": "idea.created",
"timestamp": "2025-01-15T10:30:00Z",
"data": {
"id": 123,
"slug": "dark-mode-abc123",
"title": "Dark Mode",
...
}
}
Security headers
Each webhook request includes these headers:
| Header | Description |
|---|---|
X-Scalar-Signature | HMAC-SHA256 signature for verification |
X-Scalar-Event | The event type (e.g., idea.created) |
X-Scalar-Delivery-Id | Unique ID for this delivery attempt |
Verifying signatures
Verify that webhooks come from Scalar by checking the signature:
Python example
import hmac
import hashlib
import json
def verify_signature(payload: dict, signature: str, secret: str) -> bool:
message = json.dumps(payload, separators=(",", ":"), sort_keys=True)
expected = hmac.new(
secret.encode(),
message.encode(),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)
Node.js example
Install the json-stable-stringify package: npm install json-stable-stringify or yarn add json-stable-stringify
const crypto = require('crypto');
const stringify = require('json-stable-stringify');
function verifySignature(payload, signature, secret) {
// Use a stable stringifier to ensure keys are always in the same order
const message = stringify(payload);
const expected = crypto
.createHmac('sha256', secret)
.update(message)
.digest('hex');
const expectedBuffer = Buffer.from(expected);
const signatureBuffer = Buffer.from(signature);
if (expectedBuffer.length !== signatureBuffer.length) {
return false;
}
return crypto.timingSafeEqual(expectedBuffer, signatureBuffer);
}
Testing webhooks
Send a test payload to verify your endpoint:
- Go to Settings > Webhooks
- Find your webhook
- Click Test
- Check your endpoint received the test payload
Viewing delivery history
Monitor webhook deliveries:
- Go to Settings > Webhooks
- View the Recent deliveries section
- Each delivery shows:
- Event type
- Timestamp
- Response code (200, 500, Timeout, etc.)
- Success/failure status
Retry behaviour
Scalar automatically retries failed deliveries:
| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | After 1 minute |
| 3 | After 5 minutes |
| 4 | After 5 minutes |
After 4 failed attempts, the delivery is marked as failed.
Automatic disabling
If a webhook endpoint accumulates 10 consecutive failures, it's automatically disabled. Re-enable it in the webhooks settings after fixing the issue.
Best practices
- Respond quickly: Return a 2xx status code within 10 seconds
- Be idempotent: Handle duplicate deliveries gracefully using
X-Scalar-Delivery-Id - Verify signatures: Always check the signature before processing
- Use HTTPS: Your endpoint URL must use HTTPS
- Monitor failures: Check delivery history and fix issues promptly
Editing webhooks
- Go to Settings > Webhooks
- Find the webhook
- Click Edit
- Update the URL, events, or enabled status
- Click Save changes
Disabling webhooks
To temporarily stop receiving notifications:
- Go to Settings > Webhooks
- Click Edit on the webhook
- Toggle Enabled off
- Click Save changes
The webhook remains configured but won't receive notifications until re-enabled.
Deleting webhooks
- Go to Settings > Webhooks
- Find the webhook
- Click the delete button
- Confirm deletion
The webhook stops receiving notifications immediately.
Next steps
- Generating API keys - Set up API access
- Scalar API documentation - Full API reference
