API reference

Trigger events

Send signed events to wake up your agent.

Event triggersfire when your system sends them an event. You can send it to a specific trigger's address or, with the agent's API key, by name.

Event to a trigger

POST https://csevfgnqeweymrgebayc.supabase.co/functions/v1/agent-triggers/<ID_DEL_DISPARADOR>Content-Type: application/json

Copy the address and the secret from the trigger's card (How to connect your system). The body is the event's JSON as is, up to 64 KB: the agent receives it as its data.

Authentication

Use any of these methods:

MethodHeaders
Signature (recommended)webhook-id, webhook-timestamp and webhook-signature following Standard Webhooks.
SecretAuthorization: Bearer whsec_…
Agent API keyAuthorization: Bearer qlk_live_…

The signature is a base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{cuerpo}, with the secret without the whsec_ prefix (decoded from base64), sent as v1,<firma>. The timestamp can't differ by more than 5 minutes from the current time.

import crypto from "node:crypto"const secreto = process.env.QAALIA_TRIGGER_SECRET // whsec_…const cuerpo = JSON.stringify({ pedido: "A-1042", total: 820 })const id = crypto.randomUUID()const timestamp = Math.floor(Date.now() / 1000).toString()const clave = Buffer.from(secreto.replace("whsec_", ""), "base64")const firma = crypto.createHmac("sha256", clave).update(`${id}.${timestamp}.${cuerpo}`).digest("base64")await fetch("https://csevfgnqeweymrgebayc.supabase.co/functions/v1/agent-triggers/<ID_DEL_DISPARADOR>", {  method: "POST",  headers: {    "Content-Type": "application/json",    "webhook-id": id,    "webhook-timestamp": timestamp,    "webhook-signature": `v1,${firma}`,  },  body: cuerpo,})

Event by name

If your system already uses the agent's API key, send the event by its name. It wakes up all active triggers listening to that event (up to 10).

curl -X POST "https://csevfgnqeweymrgebayc.supabase.co/functions/v1/agent-triggers" \  -H "Authorization: Bearer $QAALIA_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "evento": "venta_registrada",    "datos": { "pedido": "A-1042", "total": 820 },    "id": "evt_1042"  }'

Response

Qaalia responds 202instantly and the agent works in the background. Follow each run in the trigger's history.

HTTPReason
202Event received.
400The body isn't valid JSON.
401Invalid signature, secret or API key.
404The trigger doesn't exist or isn't of event type.
413The event exceeds 64 KB.

Retries

  • Send a unique identifier per event in webhook-id, Idempotency-Key or the id field.
  • If you resend the same event, Qaalia recognizes it and doesn't wake up the agent again.
Set up conditions on the trigger so the agent only wakes up for the events that matter, for example when total is greater than 500.