Automation inbound webhooks
Start an automation flow from another system with one signed call. The flow uses the fields of the call as variables.
#An Admin registers an endpoint
In Administration › Automation › Inbound, the Admin creates an endpoint. The answer shows its secret,
whsec_…(32 random bytes), one time. The Admin can also limit the sender's address ranges.A rotation shows a new secret one time and keeps the old one for 24 hours.
#A flow uses the endpoint
A flow editor selects the trigger Inbound webhook, names the endpoint and defines the fields. The fields come from a defined JSON structure, or an AI converter fills the same fields from the body.
#Your system signs and sends the call
Send a
POSTwith a JSON body (at most 64 KiB, depth at most 16, at most 500 keys) and the Standard Webhooks headers. Make a newwebhook-idper event and keep it for the retries of that event.SECRET="whsec_…" # from the endpoint, shown one time URL="https://app.youniton.example/webhooks/automation/<endpointId>" ID="evt_$(uuidgen)" TS=$(date +%s) BODY='{"orderId":"A-1042","status":"paid"}' KEY_HEX=$(printf '%s' "${SECRET#whsec_}" | base64 -d | xxd -p -c 256) SIG=$(printf '%s' "$ID.$TS.$BODY" | openssl dgst -sha256 -mac HMAC -macopt hexkey:$KEY_HEX -binary | base64) curl -s -X POST "$URL" \ -H "Content-Type: application/json" \ -H "webhook-id: $ID" -H "webhook-timestamp: $TS" -H "webhook-signature: v1,$SIG" \ --data "$BODY"import { createHmac, randomUUID } from "node:crypto"; export async function sendToYouniton(url, secret, payload, id = `evt_${randomUUID()}`) { const body = JSON.stringify(payload); const timestamp = Math.floor(Date.now() / 1000).toString(); const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64"); const signature = createHmac("sha256", key).update(`${id}.${timestamp}.${body}`).digest("base64"); const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", "webhook-id": id, "webhook-timestamp": timestamp, "webhook-signature": `v1,${signature}`, }, body, }); return res.status; // 202 accepted · 200 a repeat of the same id and body }import base64, hashlib, hmac, json, time, uuid, requests def send_to_youniton(url, secret, payload, msg_id=None): msg_id = msg_id or f"evt_{uuid.uuid4()}" body = json.dumps(payload, separators=(",", ":")) timestamp = str(int(time.time())) key = base64.b64decode(secret.removeprefix("whsec_")) sig = base64.b64encode(hmac.new(key, f"{msg_id}.{timestamp}.{body}".encode(), hashlib.sha256).digest()).decode() return requests.post(url, data=body, headers={ "Content-Type": "application/json", "webhook-id": msg_id, "webhook-timestamp": timestamp, "webhook-signature": f"v1,{sig}", }).status_code<?php function sendToYouniton(string $url, string $secret, array $payload, ?string $id = null): int { $id ??= 'evt_' . bin2hex(random_bytes(16)); $body = json_encode($payload, JSON_UNESCAPED_SLASHES); $timestamp = (string) time(); $key = base64_decode(preg_replace('/^whsec_/', '', $secret)); $signature = base64_encode(hash_hmac('sha256', "{$id}.{$timestamp}.{$body}", $key, true)); $res = (new GuzzleHttp\Client())->post($url, [ 'headers' => [ 'Content-Type' => 'application/json', 'webhook-id' => $id, 'webhook-timestamp' => $timestamp, 'webhook-signature' => "v1,{$signature}", ], 'body' => $body, 'http_errors' => false, ]); return $res->getStatusCode(); }#Read the answer
Answer Meaning 202Youniton recorded the call. The body holds the call's id. Runs start after it. You get no run data. 200a repeat of a known webhook-idwith the same body: nothing starts401the signature is not valid 404the endpoint is unknown, deleted or disabled, inbound webhooks are off, or your address is not in the allowed ranges 409a known webhook-idwith another body413·422the body is too large, too deep, has too many keys or is not application/json429too many calls: wait for Retry-After503the endpoint is paused: wait for Retry-AfterA timestamp more than 5 minutes from Youniton's clock is refused. Keep your server's clock in sync.
#Security of the data
- Youniton verifies the signature over the raw bytes, in constant time, before it parses the body.
- Each value that arrives is untrusted data. It never becomes an instruction or a prompt of the flow.
- A run acts as the flow's owner. The caller gets no identity and no right.
- Youniton keeps a call's body for the tenant setting
automation.inbound.callRetentionDays, and remembers eachwebhook-idfor at least 7 days.
#The Admin operations
The Youniton app manages endpoints with these operations (session only):
- GET
/automation/inbound-endpointsThe tenant's inbound endpoints - POST
/automation/inbound-endpointsRegister an endpoint; the answer holds the secret, once - PATCH
/automation/inbound-endpoints/{endpointId}Change the name, availability, address ranges or status - POST
/automation/inbound-endpoints/{endpointId}/rotate-secretIssue a new secret, shown once; the previous one stays valid for 24 hours - GET
/automation/inbound-endpoints/{endpointId}/callsThe call log of an endpoint - DELETE
/automation/inbound-endpoints/{endpointId}Delete an endpoint that no enabled or paused flow names
Was this helpful?