Nhận notifications từ IAI Flow khi có events: run completed, run failed, flow updated.
| Event | Khi nào fire |
|---|---|
run.completed | Khi run kết thúc với status success |
run.failed | Khi run kết thúc với status failed |
run.started | Khi run bắt đầu chạy |
flow.updated | Khi flow definition được cập nhật |
agent.completed | Khi agent task kết thúc |
POST https://your-endpoint.com/webhook
Content-Type: application/json
X-IAI-Event: run.completed
X-IAI-Signature: sha256=...
{
"event": "run.completed",
"timestamp": "2026-01-01T00:00:00Z",
"workspace_id": "ws_abc123",
"data": {
"run_id": "run_...",
"workflow_id": "wf_...",
"workflow_name": "My Flow",
"status": "success",
"duration_ms": 1240,
"started_at": "2026-01-01T00:00:00Z",
"finished_at": "2026-01-01T00:00:01Z"
}
}
Mỗi webhook được ký bằng HMAC-SHA256 với webhook secret của workspace.
// Node.js
const crypto = require("crypto");
function verifyWebhook(payload, signature, secret) {
const expected = "sha256=" + crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
Webhook registration API sẽ available trong phiên bản tới. Hiện tại có thể configure qua Settings trong dash.iai.one.
http_trigger hoặc webhook trong builder.