@effect/chat-whatsapp
A WhatsApp Cloud API adapter for effect/chat, for one business phone number. Includes the webhook, a pure normaliser for your own transport, a minimal Graph API client, delivery keys, template messages and read receipts.
Installation
npm install effect @effect/chat-whatsapp
Signature verification
WhatsAppChat.layerWebhook requires the Mac service; the adapter does not
provide a default. Supply NodeCrypto.layerMac from
@effect/platform-node/NodeCrypto, BunCrypto.layerMac,
DenoCrypto.layerMac, or BrowserCrypto.layerMac from the corresponding
platform package.
For other runtimes such as Workers, provide
Mac.layerWebCrypto.pipe(Layer.provide(SecureRandom.layerWebCrypto)).
Known limits
- Groups are not supported. Group webhooks are logged and dropped, and an op on a group address fails.
- WhatsApp has no edit or delete, so a streamed reply is posted part by part.
- Outside the 24 hour customer service window only templates can be sent, with
WhatsAppChat.sendTemplate. - A user can tap more than one reply button of a message, or pick one list row twice. Each tap is its own click.
Live checks
Checked on Graph API v23.0 from a Meta test number to one phone. The default baseUrl is v24.0, where these have not been repeated.
- Meta counts text bodies, interactive bodies, reply button titles, list row titles and row ids in code points. The adapter counts UTF-16 units, which is never less. Captions, the list button and section titles were not measured. A reply button id is counted in UTF-8 bytes, up to 256, and the adapter checks it that way.
- The rendered formatting displays as intended, and literal
*,_and escapes display as typed. - A
.mdfile sent astext/plainarrives with its name. - A media header beside reply buttons or a link button renders.
- Meta gave up on a webhook response after about 22 seconds. The default
deadlineis 10 seconds. - Six messages to one user in 4.4 seconds were accepted. That is one burst, not a sustained rate, so
minWriteIntervalstays at Meta's documented 6 seconds.
Not yet checked:
- Whether error 131047 comes back on the send or as a later status.
- Sending to a BSUID from a production number. A test number only sends to its allow-listed phone numbers.
- Sending from a production number whose business has Messaging accounts and a payment method, with and without
messagingAccountId. - Groups.
Links
- Website: documentation, guides, and news.
- Reference: API documentation for this package.
- Discord: ask questions, share what you're building, and talk to the core team.
- Community: meetups and events, or bring Effect to your own.
- Issues: bug reports and feature requests.
Let's talk
Whether your team is considering Effect, rolling it out, or already running it in production, we'd love to hear from you: what you're building, what works, and what you need from Effect next.
- Talk to the maintainers. Introduce your team on Discord or email contact@effectful.co. We're happy to connect privately on Slack or Discord for feedback and help with adoption.
- Production support. We're exploring how to better support teams running Effect in production. If your organization has specific support needs, let's discuss them.
- Adoption help. Our adoption partners offer implementation, consulting, team extension, training, and commercial support.