Developer documentation
Webhook actions
How to make a Zunous brain act in your systems with custom webhook actions: call format, HMAC signature verification, retries and response.
A custom action gives the brain a new tool that calls one of your webhooks: create an invoice in your ERP, record a payment, look up a customer's balance. The brain decides when to use it and with what data, always within the autonomy level your company sets.
It works with any system that receives an HTTPS webhook: n8n, Make, Power Automate, Google Apps Script, Zapier or your own server.
Create the action
An administrator creates it in the Console: brain page → Autonomous Mode → Custom actions → New action.
| Field | Rule | What it's for |
|---|---|---|
| Name | Lowercase letters, numbers and _, 2 to 40 characters | The brain sees it as the tool accion.<nombre> |
| Description | 10 to 500 characters | Tells the brain when to use it. This is the most important part: be specific |
| URL | https://, port 443, a public domain | Where the call goes |
| Data it sends | Up to 15 fields, one per line: nombre*:tipo:descripción. Types texto, numero, si_no; * marks a required field | What the brain must send |
| Type | accion or consulta | A lookup (consulta) only fetches information, skips drafts and doesn't count toward the plan |
| Autonomy level | Observe, Draft (default), Act and notify, Autonomous | Same as the built-in actions |
| Skills | The ones that can use it; empty means all | Limits where it appears |
| Daily cap | 1 to 1,000 (default 50) | On top of the brain's daily cap |
When you create it, the Console shows the signing secret (whsec_…) only once. Store it in your automation as a secret. If you lose it, click New signing secret on the same card and update it in your automation. Each brain supports up to 20 actions.
With Send test, Zunous calls your webhook with sample data and "prueba": true, without counting toward the cap.
The call
POST https://n8n.tuempresa.com/webhook/crear-factura
Content-Type: application/json
User-Agent: Zunous-Webhooks/1.0
Zunous-Event: accion.crear_factura
Zunous-Delivery: 5d0b6f0e-3c1a-4c55-9a52-3b0c0e7b9f11
Zunous-Timestamp: 1760450000
Zunous-Signature: v1=8c3f…
{
"accion": "crear_factura",
"organizacion": "acme",
"brain": "cobranza",
"ejecucion": "7b1e…",
"aprobada_por": "ana@acme.com",
"datos": { "cliente": "Luis Gómez", "valor": 1200000, "concepto": "Cuota de octubre" }
}| Field | Details |
|---|---|
ejecucion | The Autonomous Mode run that requested it, or null |
aprobada_por | Email of whoever approved the draft, or null if the brain acted on its own |
prueba | true only on Send test calls |
datos | Only the fields you defined, with their type. Nothing from the conversation or the knowledge |
Verify the signature
Always verify the signature before doing anything:
- Take the
Zunous-Timestampheader and the raw body, exactly as it arrived (without re-serializing the JSON). - Compute the HMAC-SHA256 of
"<timestamp>.<body>"with the full secret (includingwhsec_) as the key, in hexadecimal. - Compare
v1=<result>withZunous-Signaturein constant time. - Reject the call if the timestamp is more than 5 minutes old.
- Store
Zunous-Delivery: if it arrives again, it's a retry and you must not process it twice.
Node.js
import crypto from "node:crypto";
export function isValidSignature(rawBody, headers, secret) {
const ts = headers["zunous-timestamp"];
const signature = headers["zunous-signature"] ?? "";
if (!ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
const expected = "v1=" + crypto.createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex");
return signature.length === expected.length && crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}Python
import hashlib, hmac, time
def is_valid_signature(raw_body: bytes, headers: dict, secret: str) -> bool:
ts = headers.get("Zunous-Timestamp", "")
signature = headers.get("Zunous-Signature", "")
if not ts.isdigit() or abs(time.time() - int(ts)) > 300:
return False
message = ts.encode() + b"." + raw_body
expected = "v1=" + hmac.new(secret.encode(), message, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature, expected)Google Apps Script
Apps Script doesn't expose the request headers, so it can't verify the signature. Use it only with lookup actions that don't change anything, or put a step in front that does verify it (n8n, Make or your server).
n8n
In the Webhook node, turn on Raw Body to receive the body as is. Then add a Crypto node (action Hmac, type SHA256, encoding hex) over the text <Zunous-Timestamp>.<raw body>, with the secret stored as a credential, and an IF node that continues only if v1= plus the result equals Zunous-Signature.
Your response
- Respond
2xxwhen you're done. If you respond with JSON containing aresultadotext field, the brain reads that text (up to 2,000 characters) and it's recorded in the log:
{ "resultado": "Invoice FV-1023 created for $1,200,000" }- Respond
4xxif the data is unusable: the action is marked as an error, the brain knows it and it isn't retried. - The webhook response is treated as information, never as instructions.
Retries and timeouts
| Situation | What Zunous does |
|---|---|
Responds 2xx | Done |
Responds 4xx or a 3xx redirect | Error, no retry. Zunous doesn't follow redirects |
Responds 5xx, the network fails or 10 s pass | One retry after one second, with the same Zunous-Delivery and a new timestamp |
| Fails again | The brain receives the error in the same run and it's recorded in the log |
URL rules
Only https to a public domain, on port 443, with no username or password in the URL. IP addresses, localhost and internal names (.local, .internal, .lan, .corp…) are rejected.
Something unclear? Write to us at hello@zunous.com.