ElementsChannel

WhatsApp

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

oke.config.ts
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

src/core/channel.ts
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 idEnv
wa-cloudWHATSAPP_TOKEN / WA_CLOUD_TOKEN + WHATSAPP_PHONE_NUMBER_ID / WA_CLOUD_PHONE_NUMBER_ID
taqnyat-whatsappTAQNYAT_WHATSAPP_TOKEN or TAQNYAT_BEARER_TOKEN
consoleConfig 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?)

OptionTypeMeaning
fromstringDefault sender id
senderstringAlias for from

.template(name, options?)

description · locales · schema — same as other mediums.

Troubleshooting

Learn more

Next

On this page