Managed messages
Render a published definition by a stable key such as order.shipped. Copy, channel, and locale
change without redeploying your application.
Fabrik offers two server-side paths to send a message. Both run through the same environment boundary, wallet or sandbox allowance, idempotency model, and webhook scheme.
Managed messages
Render a published definition by a stable key such as order.shipped. Copy, channel, and locale
change without redeploying your application.
Direct SMS
Send a body and sender name in the request. Use this when your application already owns the rendered content.
Direct Email or WhatsApp
Use fabric.email for rendered email or fabric.whatsapp for an approved WhatsApp template.
These resources are described in the channel guides.
A managed send addresses a definition by key. The published definition decides whether the delivery is SMS, email, or WhatsApp, and Fabrik validates the variables you supply before it reserves wallet funds.
const response = await fabric.messages.send("order.shipped", { to: "+233201234567", data: { name: "Ama", ref: "GH-4821" }, reference: "order:GH-4821", idempotencyKey: "order-shipped:GH-4821",});
console.log(response.data.id, response.data.status, response.data.cost.minor);messages.send requires an idempotencyKey. The returned MessageDelivery carries a deterministic
id, the resolved channel, status, exact cost, and an attempts timeline. Retrieve it later
with fabric.messages.retrieveDelivery(id), and render output with no side effects using
fabric.messages.preview(key, …).
const response = await fabric.sms.send( { to: "+233201234567", senderId: "FABRIC", body: "Your order GH-4821 has shipped.", currency: "GHS", class: "transactional", }, { idempotencyKey: "order-shipped:GH-4821" },);
console.log(response.data.segments, response.data.encoding, response.data.cost.minor);Numbers must use E.164 format — the SDK rejects anything else before making a request. currency
defaults to GHS and class to transactional. Sandbox sends resolve on the virtual delivery path
and need no carrier approval; live sends require an active sender name for the recipient’s country.