Webhooks
Receive real-time notifications about events.
Webhooks allow you to receive real-time HTTP notifications when events occur in your Lattice workspace.
Available Events
- agent.started - Agent began execution
- agent.completed - Agent finished successfully
- agent.failed - Agent encountered an error
- workflow.triggered - Workflow was triggered
- workflow.completed - Workflow finished
Creating a Webhook
bash
POST /v1/webhooks
Body:
{
"url": "https://your-server.com/webhook",
"events": ["agent.completed", "agent.failed"],
"secret": "your_webhook_secret"
}Verifying Webhooks
javascript
import crypto from 'crypto';
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}