Follow outcomes as they happen.
Receive compact events when a destination or follow-up comment reaches a published, failed or unverified outcome.
API, MCP and webhooks are included with Studio and Agency. Compare plans.
Create a subscription
POST …/webhooks with url and events using webhooks:manage. Keep up to five active subscriptions per workspace. Use public HTTPS on port 443, resolving to public IPv4 addresses. Private addresses and redirects are rejected.
Save secret from the first successful response in your secret manager. Listing and idempotent replay omit it. Revoke and replace the subscription if it is lost.
- destination.published, destination.failed, destination.unverified
- comment.published, comment.failed, comment.unverified
Verify the signature before parsing
Read Webhook-Id, Webhook-Event-Id, Webhook-Timestamp and Webhook-Signature. Compute HMAC-SHA256 with your secret over deliveryId + "." + timestamp + "." + rawBody. The signature is v1= followed by lowercase hexadecimal. Compare it in constant time.
Reject timestamps more than five minutes from your clock. Verify the original bytes before parsing JSON. Store the delivery ID before processing to prevent duplicate effects. Retries keep that ID and body, with fresh timestamps and signatures.
import { createHmac, timingSafeEqual } from 'node:crypto';
const expected = createHmac('sha256', process.env.FARYEN_WEBHOOK_SECRET)
.update(deliveryId + '.' + timestamp + '.' + rawBody).digest('hex');
const supplied = signatureHeader.replace(/^v1=/, '');
if (!/^[a-f0-9]{64}$/.test(supplied) ||
!timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(supplied, 'hex'))) {
throw new Error('Invalid signature');
}
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) {
throw new Error('Expired webhook');
}Acknowledge, deduplicate, recover
Return 2xx quickly and process asynchronously. Delivery is at least once. Timeouts and non-2xx responses retry up to eight attempts with increasing delays, capped at one day. Faryen follows no redirects and stores no response body.
GET …/webhooks/{webhook_id}/deliveries shows state, attempts and last_status. Status 0 means DNS, connection, TLS, timeout or response validation failed. Completed records remain for 30 days. Revocation cancels pending events.
The body includes id, type, api_version, created_at, workspace_id and data with post_id, account_id, object_id and status. Fetch the post for its full current plan/result. Arrival order is not guaranteed.
Keep exploring
Integration overview