niiko/developers

Miira · leads & WhatsApp v1 current

miira.broadcast_sent

Sends the WhatsApp broadcast quoted by miira.broadcast_quoted, exactly to whom and how the quote said. If anything changed (window, consent, rate) it refuses with a new quote to confirm again. Costs money when templates are involved: do not call it without the person having seen the cost.

Last updated

POST /api/v1/actions/miira.broadcast_sent
Key scope
miira.broadcast_sent@1
Workspace permission
api.miira.broadcast_sent off by default
Guarded
Yes — the cost of the request is recorded and may be capped per workspace.
Two permissions, not one

Both are needed: a key with that scope, and the workspace owner having switched the permission on. Holding the key is not enough — they are two decisions made by different people.

Request

fieldtyperules
quotestringrequiredmin 1 · max 65536

Response — output when status is done

fieldtyperules
queuedobject[]required
costUsdstringrequired

queued[]

fieldtyperules
clientIdstringrequired
clientNamestringrequired
mode"free_text" | "template"required
outboxIdstringrequired

Example

# One request, one idempotency key: retrying with the same key never runs twice.
curl -X POST https://niiko.org/api/v1/actions/miira.broadcast_sent \
  -H "Authorization: Bearer nk_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "quote": "…"
  }'
# 200 → done · 202 → pending_approval (a person signs later) · 4xx → refused, with a named reason

Why it may refuse

Each reason names who can fix it and how. With reason stale, detail.message says what to do.

presupuesto_invalidopresupuesto_vencidopresupuesto_cambiadoplantilla_invalidatarifas_vencidassin_permiso

In the clients

@vorluno/niiko-sdkniiko.sentBroadcast()
niiko (Python)niiko.sent_broadcast()
niiko-cliniiko run miira.broadcast_sent
n8n-nodes-niikomiiraBroadcastSent
niiko-mcp-servermiira_broadcast_sent

History