Webhooks
/webhooks
GET /webhooksRetrieve a paginated list of all webhooks configured for your team.
Request
Parameters
| Name | Type | Description |
|---|---|---|
| per_page | integer | Webhooks per page (default: 15, max: 100) |
| page | integer | Page number for pagination (default: 1) |
Response (200)
Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Webhook identifier |
| url | string | Webhook URL endpoint |
| events | array | Events this webhook is subscribed to |
| active | boolean | Whether webhook is active |
| created_at | string | ISO 8601 creation timestamp |
[
{
"id": "webhook_123",
"url": "https://example.com/webhooks/subscribr",
"events": [
"script.generated",
"idea.created"
],
"active": true,
"created_at": "2024-01-10T08:00:00Z"
}
]
/webhooks
POST /webhooksCreate a new webhook to receive notifications about events in your Subscribr account.
Request
{
"url": "string (required) - HTTPS URL where webhooks will be sent",
"events": "array (required) - Events to subscribe to, e.g., [\"script.generated\", \"idea.created\"]",
"active": "boolean (optional) - Activate webhook immediately (default: true)"
}
Response (201)
Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Webhook identifier |
| url | string | Webhook URL endpoint |
| events | array | Subscribed events |
| active | boolean | Active status |
| secret | string | Secret for HMAC signature verification |
| created_at | string | ISO 8601 creation timestamp |
{
"id": "webhook_456",
"url": "https://example.com/webhooks/subscribr",
"events": [
"script.generated",
"idea.created"
],
"active": true,
"secret": "whk_secret_abcdef123456",
"created_at": "2024-01-26T10:00:00Z"
}
/webhooks/{webhook}
GET /webhooks/{webhook}Retrieve detailed information about a specific webhook.
Request
Parameters
| Name | Type | Description |
|---|---|---|
| webhook | string | Webhook ID (path parameter) |
Response (200)
Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Webhook identifier |
| url | string | Webhook URL endpoint |
| events | array | Subscribed events |
| active | boolean | Active status |
| last_triggered_at | string|null | Last webhook trigger timestamp |
| created_at | string | ISO 8601 creation timestamp |
{
"id": "webhook_456",
"url": "https://example.com/webhooks/subscribr",
"events": [
"script.generated",
"idea.created"
],
"active": true,
"last_triggered_at": "2024-01-25T14:22:00Z",
"created_at": "2024-01-26T10:00:00Z"
}
/webhooks/{webhook}
PUT /webhooks/{webhook}Update an existing webhook's configuration including URL, events, and active status.
Request
{
"url": "string (optional) - New webhook URL",
"events": "array (optional) - Updated list of events",
"active": "boolean (optional) - Activate or deactivate webhook"
}
Response (200)
Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Webhook identifier |
| url | string | Webhook URL endpoint |
| events | array | Subscribed events |
| active | boolean | Active status |
| updated_at | string | ISO 8601 last update timestamp |
{
"id": "webhook_456",
"url": "https://example.com/webhooks/subscribr",
"events": [
"script.generated"
],
"active": false,
"updated_at": "2024-01-26T11:00:00Z"
}
/webhooks/{webhook}
DELETE /webhooks/{webhook}Delete a webhook. No further events will be sent to the webhook URL.
Request
Parameters
| Name | Type | Description |
|---|---|---|
| webhook | string | Webhook ID (path parameter) |
Response (204)
/webhooks/{webhook}/test
POST /webhooks/{webhook}/testSend a test webhook event to your configured URL. Useful for testing your webhook handler.
Request
Parameters
| Name | Type | Description |
|---|---|---|
| webhook | string | Webhook ID (path parameter) |
Response (200)
Response Fields
| Field | Type | Description |
|---|---|---|
| status | string | Delivery status (sent, failed) |
| event_type | string | Event type sent in test |
| sent_at | string | ISO 8601 timestamp when test was sent |
{
"status": "sent",
"event_type": "webhook.test",
"sent_at": "2024-01-26T11:30:00Z"
}
Webhook Events
Reference documentation for all webhook events that can be subscribed to.
Webhooks allow you to receive real-time notifications about important events in your Subscribr account. Subscribe to the events you care about and your webhook endpoint will receive POST requests with event details.
Webhook Security
Learn how to secure and verify webhook requests from Subscribr.
All webhook requests from Subscribr are signed with HMAC SHA-256. You should verify this signature to ensure the request is authentic and hasn't been tampered with.
The signature is provided in the `X-Subscribr-Signature` header. It's computed using your webhook secret and the raw request body.
const crypto = require("crypto");
function verifyWebhookSignature(body, signature, secret) {
const hash = crypto
.createHmac("sha256", secret)
.update(body, "utf8")
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(hash),
Buffer.from(signature)
);
}
// In your webhook handler:
const signature = req.headers["x-subscribr-signature"];
const body = req.rawBody; // Raw request body as string
const secret = process.env.WEBHOOK_SECRET;
if (!verifyWebhookSignature(body, signature, secret)) {
return res.status(401).json({ error: "Invalid signature" });
}
// Process webhook...
res.status(200).json({ success: true });