Webhooks
Trigger DAICISION flows from external systems using webhook endpoints — with HMAC signature verification and replay protection.
Webhooks
Webhooks allow external systems to trigger DAICISION flows by sending an HTTP POST request to a public endpoint. Each webhook-triggered flow has a unique URL that accepts JSON payloads and optionally verifies request signatures.
Webhook URL
Every flow configured with a Webhook trigger type exposes a public endpoint:
POST /api/v1/webhooks/flows/:flowId
No authentication required
Webhook endpoints are public. Security is enforced through HMAC signature verification — configure a signature secret on your flow's trigger settings.
Sending a Webhook
curl -X POST https://<your-instance>/api/v1/webhooks/flows/abc123-... \
-H "Content-Type: application/json" \
-H "X-Flow-Signature: sha256=e3b0c44298fc..." \
-H "X-Flow-Timestamp: 1710672000" \
-d '{"event": "order.created", "orderId": "ORD-456"}'
Response (202 Accepted):
{
"success": true,
"executionId": "exec-789...",
"status": "QUEUED"
}
The flow executes asynchronously. Use the Executions API to monitor progress.
Request Requirements
| Requirement | Detail |
|---|---|
| Method | POST only |
| Content type | application/json |
| Flow status | Must be ACTIVE with trigger type WEBHOOK |
| Body | Valid JSON (object or primitive) |
If the body is a JSON object, it is passed directly as trigger data. Primitive values are wrapped as { "payload": <value> }.
HMAC Signature Verification
When a signature secret is configured on the flow trigger, DAICISION verifies every incoming request using HMAC.
How signatures work:
X-Flow-Timestamp headerHMAC-SHA256(secret, timestamp + "." + rawBody)X-Flow-Signature headerTrigger Configuration
Configure these options in the flow trigger settings:
| Setting | Default | Description |
|---|---|---|
| signatureSecret | — | HMAC secret key (enables verification when set) |
| signatureHeader | x-flow-signature | Header containing the HMAC signature |
| signatureAlgorithm | sha256 | Hash algorithm (sha256, sha512, etc.) |
| requireSignature | false | Reject unsigned requests (auto-enabled when secret is set) |
| timestampHeader | x-flow-timestamp | Header containing the Unix timestamp |
| replayWindowSeconds | 300 | Maximum age of a request (5 minutes by default) |
Replay Protection
When a timestamp header is present, DAICISION rejects requests older than replayWindowSeconds (default: 5 minutes). This prevents replay attacks where a captured webhook payload is re-sent.
Computing Signatures
Node.js:
import { createHmac } from 'crypto';
function signWebhook(
secret: string,
timestamp: number,
body: string
): string {
const payload = `${timestamp}.${body}`;
return createHmac('sha256', secret)
.update(payload, 'utf8')
.digest('hex');
}
const timestamp = Math.floor(Date.now() / 1000);
const body = JSON.stringify({ event: 'order.created', orderId: 'ORD-456' });
const signature = signWebhook(process.env.WEBHOOK_SECRET, timestamp, body);
Python:
import hmac, hashlib, time, json
def sign_webhook(secret: str, timestamp: int, body: str) -> str:
payload = f"{timestamp}.{body}"
return hmac.new(
secret.encode(), payload.encode(), hashlib.sha256
).hexdigest()
timestamp = int(time.time())
body = json.dumps({"event": "order.created", "orderId": "ORD-456"})
signature = sign_webhook(os.environ["WEBHOOK_SECRET"], timestamp, body)
Error Responses
| Status | Reason |
|---|---|
| 400 | Invalid or missing signature, stale timestamp, malformed body |
| 404 | Flow not found, not active, or not a webhook trigger |
| 429 | Rate limit exceeded |
Best Practices
replayWindowSeconds to the smallest value your system toleratesX-Correlation-ID from responses for debugging