codespar_notify
Messaging meta-tool. WhatsApp BR via Z-API; SMS / email USD via Twilio + SendGrid; WhatsApp INTL via Twilio.
codespar_notify
Meta-tool
codespar_notify is the unified messaging interface for transactional notifications — order confirmations, shipping updates, payment receipts, KYC nudges. The agent picks recipient and message; CodeSpar picks the channel and rail.
There is no typed wrapper yet — call via session.execute() (or session.send() if you do not need the delivery receipt).
Rails
| Rail | Currency | Country | Provider | Notes |
|---|---|---|---|---|
| BRL | BR | Z-API | Default for BR — path_secret auth, phone_id-scoped | |
| INTL | INTL | Twilio | Form-encoded body. Different from Z-API's JSON shape | |
| SMS | USD | INTL | Twilio | Account SID + Auth Token |
| USD | INTL | SendGrid | API key |
The router prefers Z-API for BR WhatsApp because Z-API has lower latency and supports template-free chat for verified business numbers; Twilio is the global fallback.
Direct execute
const result = await session.execute("codespar_notify", {
recipient: "+5511999998888",
message: "Olá, Maria! Seu pedido #1234 foi enviado. Rastreio: BR123456789.",
channel: "whatsapp",
});
console.log(result.id, result.status); // "queued" or "sent"For email:
const result = await session.execute("codespar_notify", {
recipient: "maria@example.com",
subject: "Order #1234 confirmation",
message: "Hi Maria, your order has shipped.",
channel: "email",
});Args shape
| Field | Type | Required | Description |
|---|---|---|---|
recipient | string | Yes | Phone in E.164 format (+5511...) for WhatsApp/SMS, email address for email |
message | string | Yes | Body content. WhatsApp BR honors plaintext; email + SMS truncate at provider limits |
channel | string | No | whatsapp, sms, email. Inferred from recipient shape if omitted |
subject | string | No | Email only |
template_id | string | No | Provider-side template id (Z-API HSM, Twilio template, SendGrid dynamic-template) |
variables | object | No | Template substitutions when template_id is set |
Result shape
type NotifyResult = {
id: string; // provider message id
status: "queued" | "sent" | "delivered" | "failed";
channel: string;
delivered_at?: string; // ISO 8601, set on terminal "delivered"
};For session.execute() you get the synchronous send/queue result. Delivery confirmation lands later as a webhook — wire a trigger on notify.delivered if you need it.
Operator setup
Each rail wants its own credentials in /dashboard/auth-configs:
- Z-API —
path_secretauth_type. Operator uploads a phone-id (path-embedded) plus a companion header token. Connection scoped to a single Z-API instance. - Twilio — Account SID + Auth Token (basic-auth shape). Same credentials drive SMS, voice, and Twilio WhatsApp.
- SendGrid — API key (
api_keyauth_type) withmail.sendscope.
For Z-API the path_secret pattern is documented in path_secret auth — the phone_id is the path component and the companion header is Client-Token.
See also
- Tools & meta-tools — full meta-tool list
- Pix Payment Agent cookbook —
codespar_notifypaired withcodespar_pay - Webhook Listener cookbook — fire-and-forget on settlement
- Triggers — subscribe to
notify.deliveredevents
Last updated on