Receive real-time notifications when events occur in your AI agents. Webhooks allow you to build event-driven integrations and keep external systems synchronized with agent activities.
POST /api/integrations/webhookHMAC SHA-256 signature verification
message.createdNew message receivedsession.startedNew conversation sessionsession.endedConversation session closederror.occurredError in processingagent.updatedAgent configuration changed// Express.js webhook handler
const express = require('express');
const crypto = require('crypto');
const app = express();
app.post('/webhook', express.raw({type: 'application/json'}), (req, res) => {
const signature = req.headers['x-centralai-signature'];
const secret = process.env.WEBHOOK_SECRET;
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(req.body)
.digest('hex');
if (signature !== expectedSignature) {
return res.status(401).send('Invalid signature');
}
const event = JSON.parse(req.body);
console.log('Received event:', event.event, event.data);
res.status(200).send('OK');
});from flask import Flask, request
import hmac
import hashlib
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
signature = request.headers.get('X-CentralAI-Signature')
secret = os.environ.get('WEBHOOK_SECRET')
expected_signature = hmac.new(
secret.encode(),
request.data,
hashlib.sha256
).hexdigest()
if signature != expected_signature:
return 'Invalid signature', 401
event = request.json
print(f"Event: {event['event']}")
print(f"Data: {event['data']}")
return 'OK', 200Solution: Verify URL is HTTPS and publicly accessible, check firewall rules, verify webhook is active in dashboard
Solution: Ensure you're using the correct webhook secret and computing HMAC SHA-256 correctly