Receive real-time event notifications via HTTP callbacks
Webhooks let Yativo push event data to your server the moment something happens, instead of you polling the API. When an event fires, Yativo sends an HTTP POST to your configured endpoint with a signed JSON payload.
Every webhook request includes an X-Webhook-Signature header. This is an HMAC-SHA256 signature of the raw request body, computed using your webhook secret.Always verify the signature before processing webhook events. This confirms the request came from Yativo and was not tampered with.
TypeScript / Node.js
Python
PHP
Copy
Ask AI
import crypto from 'crypto';import { Request, Response } from 'express';const WEBHOOK_SECRET = process.env.YATIVO_WEBHOOK_SECRET!;export function verifyWebhook(req: Request, res: Response, next: Function) { const signature = req.headers['x-webhook-signature'] as string; const rawBody = (req as any).rawBody as Buffer; // ensure body parser preserves raw bytes if (!signature || !rawBody) { return res.status(400).json({ error: 'Missing signature or body' }); } const expected = crypto .createHmac('sha256', WEBHOOK_SECRET) .update(rawBody) .digest('hex'); const isValid = crypto.timingSafeEqual( Buffer.from(signature, 'hex'), Buffer.from(expected, 'hex') ); if (!isValid) { return res.status(401).json({ error: 'Invalid signature' }); } next();}
Your endpoint should return a 200 status within a few seconds. Do your heavy processing in the background. If Yativo does not receive a 2xx response, it will retry the event with exponential backoff.
Handle duplicates idempotently
Webhooks can be delivered more than once (e.g., after retries). Use the id field to deduplicate events in your database before processing.
Use HTTPS
Yativo only delivers webhooks to HTTPS endpoints. HTTP endpoints will be rejected at configuration time.
Monitor the event log
Check /webhook/{id}/events regularly to spot delivery failures before they become business problems.
⌘I
Assistant
Responses are generated using AI and may contain mistakes.