Repository navigation
Releases
v1.4.1
Added
retryMessageSendsoption onWhatsAppClientConfig(defaultfalse). Set it totrueto retry message sends on5xx, network and timeout failures as well as429. Meta documents no idempotency for sends, so a retry can deliver a message twice.AGENTS-CONSUMER.mdis included in the npm package.- CI check of the packed package with Are the Types Wrong for the
.,./weband./testingentry points.
Changed
- Message sends (
POST {phoneNumberId}/messages: every sender,sendRaw, mark-as-read and typing indicators) now retry on HTTP429only. A transient5xxon a send now surfaces as an error by default, as do network failures and timeouts. Previously these were retried, which could send the same message twice. SetretryMessageSends: trueto get the old behaviour.GET,DELETEand otherPOSTrequests keep the existing retry policy. - The Cloudflare Workers example now uses
@cloudflare/vitest-plugin, the renamed successor of the deprecated@cloudflare/vitest-pool-workers.
Fixed
- TypeScript projects using
moduleResolution: node10could not resolve types for@solvejet/whatsapp-cloud-api/weband/testing.package.jsonnow hastypesVersionsfor both. Runtime resolution is unchanged. - A request aborted through its
signalis no longer retried. - A
200response with a body that is not valid JSON is no longer retried.
v1.4.0
Added
createWebhookHandler: an event-driven webhook handler.handleVerificationanswers the handshake,handleDelivery(rawBody, signature)andhandleRequest(request)verifyX-Hub-Signature-256over the raw bytes, parse the delivery and call handlers registered withon. Options:appSecrets(one secret or an array for rotation),verifyToken,resolveTenant,allowUnsigned,maxBodyBytes,maxEventAgeSeconds,dedupe,dedupeKey,ackMode,waitUntil,retryOnHandlerError,concurrencyandonError.- Typed events and
parseWebhookEvents:message,status,error,call,flow,template,account,groupandunknown, each with actx(WABA ID, field, time, metadata, matching contact). Fields the SDK does not model arrive asunknownwith the untouchedvalue. createMemoryDedupeand theWebhookDedupeinterface, with default keysmessage:<id>andstatus:<id>:<status>.@solvejet/whatsapp-cloud-api/webentry point with the handler, parsers, dedupe andverifySignatureAsync. It uses Web Crypto and imports nothing fromnode:*, so it runs on Cloudflare Workers, Deno, Bun and Node 20+ (all run in CI). Vercel Edge is documented but not run in CI.@solvejet/whatsapp-cloud-api/testingentry point:signWebhookBody,buildWebhookPayloadandcreateTestRequestfor testing handlers in-process.- Incoming message types
order,unsupported,editandrevoke, andinteractive.typevaluesproductandcall_permission_reply. - Helpers
isKnownMessage,getUserKeyandisStale. verifySignatureandWebhookHandleraccept an array of app secrets, so an old and a new secret can both be valid during rotation.allowUnsignedoption forWebhookHandlerandcreateWebhookHandler.- CI jobs that run the built web entry on Deno, Bun and Cloudflare workerd, and a Node 20 smoke test of every entry point as ESM and CJS.
- Examples rewritten on
createWebhookHandler, an edge-runtime example for Cloudflare Workers, a lower-level example, and documentation pages for the handler, edge runtimes and testing.
Changed
- The
IncomingMessageunion has new members (order,unsupported,edit,revoke), andinteractive.typeis wider. Code that checks aswitchonmessage.typefor exhaustiveness with aneverassignment no longer compiles until it handles the new cases or has adefaultbranch. - Accepting a webhook body without an
appSecretnow emits a one-time process warning (WHATSAPP_WEBHOOK_UNSIGNED, orconsole.warnwhereprocess.emitWarningis missing). Behaviour is otherwise unchanged. SetallowUnsigned: trueto silence it. verifySignatureandWebhookHandlernow accept an array for the app secret (a widening). Version 1.3.x returnedfalseor threw for an array. An empty array, an array with an empty string and an array with no matching secret still fail closed.package.jsonexportsuses separatetypesconditions forimportandrequirefor every entry point, and adds./weband./testing.
Deprecated
- Accepting unsigned deliveries without
allowUnsigned: true. Version 2.0 will require an explicit opt-out; setappSecret(orappSecrets) now.
v1.3.2
Metadata release. No code changes.
- Documentation site: https://solvejet.github.io/whatsapp-cloud-api/ with guides for webhook signature verification, the
hub.challengehandshake, templates, interactive messages, media, rate limits and the 24-hour window, framework recipes for Express, Next.js, Hono and Fastify, migration guides, and a generated API reference. - The package
homepagenow points to the documentation site, so the npm page links to it.
See the CHANGELOG.
v1.3.1
Security hardening for webhook verification and parsing, plus type and documentation fixes.
Security
- Webhook verification now fails closed:
verifySignaturereturnsfalsefor an empty or non-string secret (previously an empty key could produce a valid-looking check), andverifyWebhook/verifyWebhookQueryreturn 403 for an empty verify token. - The
WebhookHandlerconstructor throwsWhatsAppWebhookErrorwhenappSecretorverifyTokenis present but undefined or empty, so an unset environment variable no longer silently disables verification. Omitting theappSecretkey entirely still means no signature enforcement. WebhookHandler.parseandparseWebhookreject bodies over 3 MiB (Meta's documented maximum) before parsing; configure withmaxBodyBytes.- JSON parse errors no longer carry a fragment of the request body as
cause. - Trailing slashes of
baseUrlare trimmed in linear time (fixes a CodeQL polynomial-ReDoS finding).
Fixed
- Byte bodies:
Uint8Array,BufferandArrayBuffernow verify and parse. - Extractors no longer throw on very large arrays (RangeError near 125k elements) or on malformed shapes.
- Examples and README now parse before responding, return
text/plainfor the verification challenge, and return 401 only for a bad signature.
Behavior change
extractMessagesandextractStatusesread only themessageswebhook field. Call status events from thecallsfield are no longer returned as message statuses; read them fromparsed.raw.
Types
- Optional additions only:
playedstatus,biz_opaque_callback_data,pricing.type/subtype, Click to WhatsAppreferral, messagecontextflags, and more. See the CHANGELOG.
Zero runtime dependencies. Requires Node.js 20+.
v1.3.0
Added
- Business-scoped user IDs (BSUIDs) and usernames. Webhook types gain optional
user_id,parent_user_idandprofile.usernameon contacts,from_user_id,from_parent_user_idandgroup_idon incoming messages,recipient_user_idandrecipient_parent_user_idon statuses, plus asystemmessage type. Every message sender accepts a{ bsuid }recipient. client.messages.sendRaw(body, options?)to send message shapes the SDK does not wrap yet, with the same retries, timeouts and typed errors.examples/: Express, Next.js App Router, Hono and Fastify webhook servers (verify-token handshake and raw-body signature check) plus a send script. Typechecked in CI.- README rewrite (quickstart first, comparison, raw-body webhook troubleshooting, runtime support) and a
docs/folder for templates, Flows, Block, Calling and errors.
Changed
- The default Graph API version is now v26.0 (was v23.0).
apiVersionstays configurable. wa_id,fromandrecipient_idstay typedstring, but Meta may omit them in some username-based events. Do not assume they are always present.
Zero runtime dependencies. Requires Node.js 20+. See the CHANGELOG.
v1.2.1
1.2.1
Changed
- Documentation: added the Calling media plane (WebRTC/SIP) to the roadmap as an optional future helper. The Calling REST signaling and settings are implemented in
client.calls; the real-time media layer remains the caller's responsibility for now.
No code or API changes. Published automatically from CI via npm OIDC trusted publishing with signed provenance.
v1.2.0
1.2.0
Added
- Flows management via
client.flows:create,list,get,update,updateJson(multipartFLOW_JSONupload),publish,deprecate,delete,listAssets, andgetPreviewfor building and managing WhatsApp Flows on a WABA. - Block API via
client.blocks:blockandunblock(up to 1,000 users per request, with per-user success/failure results) andlist(paginated blocklist). Only users who messaged your business in the last 24 hours can be blocked. - Calling via
client.calls:getSettings/updateSettingsto enable and configure the Calling API (status, call icon visibility, callback permissions, call hours, SIP), plus the REST call lifecycle —initiate,preAccept,accept,reject, andterminate.- Scope note: this wraps the Calling API's REST signaling and settings only. The real-time media layer (SDP offer/answer over WebRTC/SIP) is the caller's responsibility; SDP is passed through as opaque strings.
Published automatically from CI via npm OIDC trusted publishing with signed provenance.
v1.1.0
1.1.0
Discoverability release — no code or API changes.
Changed
- Richer npm
descriptionand expandedkeywordsso the SDK surfaces in npm search and in search/LLM results for queries like "WhatsApp Cloud API TypeScript SDK", "send WhatsApp message Node.js", and "verify WhatsApp webhooks". - README: added a "Why this library" positioning section, a "What you can do" capability table, and an FAQ (how to send a message/template, verify webhooks, dependencies, supported Node.js versions, official-SDK clarification, error/rate-limit handling).
Published automatically from CI via npm OIDC trusted publishing with signed provenance.
v1.0.1
1.0.1 — first stable release
The public API is now stable. This project follows Semantic Versioning: breaking changes will only ship in a new major version.
No functional changes from 0.5.0 — this release marks the existing feature set as stable.
1.0.0is skipped: an old1.0.0was published to npm and later unpublished, and npm permanently reserves unpublished version numbers.1.0.1is the first stable1.xrelease on npm.
The stable surface
- Outbound messaging — text, media, location, contacts, templates, interactive (buttons, lists, CTA URL, flow, location request, product, product list, address message), reactions, mark-as-read, typing indicator; reply threading on every sender.
- Inbound webhooks — verification handshake, signature validation, typed parsing (incl.
nfm_reply) and status updates. - Media lifecycle — upload, URL resolution, download, delete.
- Phone number & WABA management —
client.phoneNumbers,client.waba. - Message-template management —
client.templates(list/get/create/edit/delete). - Typed errors +
WhatsAppErrorCodeconstants, and client-side validation of documented limits.
Published automatically from CI via npm OIDC trusted publishing with signed provenance.
v0.5.0
0.5.0
Added
- Message-template management via
client.templates:list— list templates on a WABA with field selection, paging, andname/status/category/languagefilters.get— fetch a single template by ID.create— create a template with typed header/body/footer/buttons components, named or positional parameters, category, and optional send TTL. Client-side validation enforces the documented limits (name charset/length, exactly one BODY component, text-length caps, ≤10 buttons) before the request.edit— update an approved template's category/components (name and language are immutable; editing resets it to review).delete— delete all language versions of a template by name, or a single version viahsm_id.
- New template-management types, with the management component union exported as
MessageTemplateComponentto avoid colliding with the existing send-sideTemplateComponent.
The existing sendTemplate sender and its types are unchanged.
Published automatically from CI via npm OIDC trusted publishing with signed provenance.