WhatsApp medium — channel.whatsapp templates, wa-cloud and taqnyat-whatsapp drivers, app-mode OTP delivery.
WhatsApp (channel.whatsapp) is its own medium — not a Push subtype. Declare templates, pin a
WhatsApp driver (opt-in; no default), and send with fx.send or include WhatsApp in
fx.deliverOtp failover.
For developers reaching users on Meta Cloud or Taqnyat WhatsApp — same Channel physics as SMS.
The one rule
Use channel.whatsapp(…).template(…) and set drivers.channel.whatsapp to wa-cloud or
taqnyat-whatsapp. Boot opens WhatsApp when configured; Push drivers are separate and not
auto-bound.
Smallest Example
Pin a WhatsApp driver
import { defineConfig } from "okengine/config";
export default defineConfig({
drivers: {
channel: {
whatsapp: { prod: "wa-cloud" },
},
},
});wa-cloud needs WHATSAPP_TOKEN (or WA_CLOUD_TOKEN) and WHATSAPP_PHONE_NUMBER_ID
(or WA_CLOUD_PHONE_NUMBER_ID).
Declare and send
import { channel } from "okengine";
import { z } from "zod";
const wa = channel.whatsapp();
export const bookingReminder = wa.template("booking.reminder", {
locales: ["en", "ar"],
schema: z.object({ when: z.string(), place: z.string() }),
});await fx.send(bookingReminder, {
to: "+9665xxxxxxx",
data: { when: "Thu 15:00", place: "Clinic A" },
locale: "ar",
});Confirm the effect
Manifest / Console list sends: ["booking.reminder"]. Receipts follow the same ledger as email
and SMS.
Progressive Patterns
Catalog typically supplies text (and optional subject where the transport uses it):
oke({
channel: {
catalog: {
"booking.reminder": {
en: { text: "Reminder: {{when}} at {{place}}" },
ar: { text: "تذكير: {{when}} — {{place}}" },
},
},
},
});Drivers
| Driver id | Env |
|---|---|
wa-cloud | WHATSAPP_TOKEN / WA_CLOUD_TOKEN + WHATSAPP_PHONE_NUMBER_ID / WA_CLOUD_PHONE_NUMBER_ID |
taqnyat-whatsapp | TAQNYAT_WHATSAPP_TOKEN or TAQNYAT_BEARER_TOKEN |
console | Config id — opens no WhatsApp driver |
oke boot: wa-cloud channel needs WHATSAPP_TOKEN and WHATSAPP_PHONE_NUMBER_ID
oke boot: unknown whatsapp channel driver "…"Options Reference
channel.whatsapp(options?)
| Option | Type | Meaning |
|---|---|---|
from | string | Default sender id |
sender | string | Alias for from |
.template(name, options?)
description · locales · schema — same as other mediums.
Troubleshooting
Both token and phone-number id are required for Meta Cloud. Check alias env names (WA_CLOUD_*)
if you use those.
Set the WhatsApp-specific token or reuse TAQNYAT_BEARER_TOKEN.
drivers.channel.whatsapp unset for this env, or id is console. Pin wa-cloud or
taqnyat-whatsapp.
Template not auto-registered — import the channel.whatsapp().template(…) module before oke(),
or pass channel.templates.
Learn more
- SMS — OTP modes and
fx.deliverOtp - Push — FCM / Web Push (separate medium)
- Channel overview — locale, via, effects
- OTP plugin — multi-channel auth OTP