Webhook Setup
Set up webhooks to receive real-time notifications.
Create a Webhook
curl -X POST https://api.agentry.to/agent/v0/webhooks \
-H "Authorization: Bearer ag_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhook",
"event_types": ["message.received", "message.bounced"]
}'Handle Webhook Events
Your endpoint should:
- Return a
200status code quickly - Process the event asynchronously if needed
- Handle duplicate deliveries (webhooks may retry)
app.post("/webhook", (req, res) => {
const event = req.body;
switch (event.event) {
case "message.received":
// Process inbound email
handleInboundEmail(event.data);
break;
case "message.bounced":
// Handle bounce
handleBounce(event.data);
break;
}
res.status(200).send("OK");
});Managing Webhooks
- List:
GET /agent/v0/webhooks - Update:
PATCH /agent/v0/webhooks/{webhook_id} - Delete:
DELETE /agent/v0/webhooks/{webhook_id} - Scope updates:
PATCH /agent/v0/webhooks/{webhook_id}withadd_inbox_ids,remove_inbox_ids,add_pod_ids,remove_pod_ids