Changelog
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[1.4.1] - 2026-11-22
Section titled “[1.4.1] - 2026-11-22”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
Section titled “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.
- 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.
1.4.0 - 2026-11-21
Section titled “1.4.0 - 2026-11-21”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
Section titled “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
Section titled “Deprecated”- Accepting unsigned deliveries without
allowUnsigned: true. Version 2.0 will require an explicit opt-out; setappSecret(orappSecrets) now.
1.3.2 - 2026-11-21
Section titled “1.3.2 - 2026-11-21”- Documentation site at https://solvejet.github.io/whatsapp-cloud-api/, built from the README and
docs/, with how-to guides for webhook signature verification, thehub.challengehandshake, templates, media and rate limits, framework recipes, and a generated API reference. It is deployed to GitHub Pages frommaster.
Changed
Section titled “Changed”- The package
homepagenow points to the documentation site, so the npm page links to it.
1.3.1 - 2026-11-20
Section titled “1.3.1 - 2026-11-20”Security
Section titled “Security”- Webhook verification now fails closed on a bad secret.
verifySignaturereturnsfalse(it never throws) when the app secret is not a non-empty string, so an empty key can no longer validate a signature.verifyWebhookandverifyWebhookQueryreturn403when the expected verify token is empty or not a string. - The
WebhookHandlerconstructor throwsWhatsAppWebhookErrorwhenappSecretorverifyTokenis present butundefined, empty or not a string, so an unset environment variable no longer silently disables verification. Omitting theappSecretkey entirely still means no signature enforcement, as documented. - The JSON
SyntaxErroris no longer attached ascauseon “not valid JSON” errors, because its message embeds a fragment of the request body. WebhookHandler.parseandparseWebhookreject string and byte bodies larger than 3 MiB (Meta’s documented maximum) before parsing. Configure it with the newmaxBodyBytesoption (WebhookHandlerConfig.maxBodyBytes,ParseWebhookOptions.maxBodyBytes);falsedisables the check.
-
Trailing slashes of
baseUrlare now trimmed in linear time instead of with a backtracking regular expression. -
extractMessagesandextractStatusesno longer throwRangeErroron arrays of about 125,000 or more elements, skip non-object elements ofmessagesandstatuses, and treat non-arraychangesand non-objectentryitems as empty instead of throwing aTypeError. -
Byte bodies are decoded with
TextDecoder(ignoreBOM). A plainUint8Arraybody previously decoded to a comma-separated list of numbers and failed with “not valid JSON”. -
verifySignaturereturnsfalseinstead of throwing for an unsupported body type such asnull, a number or anArrayBuffer, which used to throw aTypeError(anArrayBufferis now supported). -
The README and the Express, Next.js, Hono and Fastify examples now parse before responding, send
text/plainfor the verification challenge, return401only for a bad signature and200(logged) for a signed payload that cannot be parsed, and the Next.js example no longer blocks on awaiting every message in turn. -
InteractiveNfmReply.namedocumentsflowfor Flows responses andaddress_messagefor address messages.
Changed
Section titled “Changed”- Behavior change:
extractMessagesandextractStatuses(and soWebhookHandler.parse) now only read changes whosefieldismessages, or whosefieldis not a string. Call status events from thecallsfield (RINGING,ACCEPTED,REJECTED) are no longer returned asMessageStatus, and amessagesarray under another field is ignored. Read those payloads fromparsed.raw. WebhookHandler.isValid,verifyOrThrow,parse,verifySignatureandparseWebhookacceptUint8Array(includingBuffer) andArrayBufferraw bodies in addition to strings. New exported typesWebhookRawBody,ParseWebhookOptionsandWebhookMessageReferral.- Webhook types gain optional fields only: the
playedstatus,recipient_type,recipient_participant_id,recipient_identity_key_hashandbiz_opaque_callback_dataon statuses,pricing.typeandpricing.subtype,hrefon webhook errors,timeon entries,identity_key_hashon contacts,forwarded,frequently_forwardedandreferred_producton message context, a Click to WhatsAppreferralanderrorson incoming messages, mediaurl, stickeranimatedandlocation.url.reaction.emojistays typedstringalthough Meta omits it when a reaction is removed; check it at runtime.
1.3.0 - 2026-11-21
Section titled “1.3.0 - 2026-11-21”- Business-scoped user ID (BSUID) and username support. 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, and asystemmessage type (SystemIncomingMessage) for phone number and BSUID changes. - Every message sender accepts a
{ bsuid }recipient (BsuidRecipient,MessageRecipient). It is sent asrecipientwithtoomitted. Phone-number strings work as before.SendMessageResponse.contacts[]gains optionaluser_idandparent_user_id. client.messages.sendRaw(body, options?)posts an arbitrary body to{phoneNumberId}/messages, addsmessaging_product: 'whatsapp'when absent, and takes an optionalphoneNumberId(SendRawOptions) and a response type parameter.examples/with Express, Next.js App Router, Hono and Fastify webhook servers and a send script. Each answers the verify-token handshake and verifies the signature against the raw body.- README sections for the quickstart, comparison with alternatives, raw-body webhook troubleshooting, BSUIDs,
sendRawand runtime support. Template, Flows, Block, Calling and error-handling reference moved todocs/.
Changed
Section titled “Changed”- The default Graph API version is now
v26.0(wasv23.0).apiVersionis still configurable. wa_id,fromandrecipient_idstay typedstringeven though Meta may omit them in some username-based events. A future major version may make them optional.
Removed
Section titled “Removed”- The Python and Rust ports line from the README roadmap.
1.2.1 - 2026-10-09
Section titled “1.2.1 - 2026-10-09”Changed
Section titled “Changed”- Documentation: added the Calling media plane (WebRTC/SIP) to the README roadmap — optional future helpers for the real-time media layer that is currently the caller’s responsibility (the Calling REST signaling and settings are implemented in
client.calls).
1.2.0 - 2026-10-09
Section titled “1.2.0 - 2026-10-09”- Flows management via
client.flows(WABA-scoped, defaults to the configuredbusinessAccountId):create,list,get,update,updateJson,publish,deprecate,delete,listAssets, andgetPreview.createvalidates a non-emptynameand a non-emptycategoriesarray client-side before sending, and every flow-id method validates a non-emptyflowId;updaterequires at least one editable field.updateJsonuploads the Flow JSON as a multipartFLOW_JSONasset (aBlob,Uint8Array, or string wrapped as anapplication/jsonBlob) with no manualContent-Type.getPreviewrequestsfields=preview.invalidate(<bool>). Note: onlyDRAFTflows are deletable. New exported typesFlow,FlowList,FlowCategory,FlowStatus,FlowValidationError,CreateFlowPayload,CreateFlowResponse,UpdateFlowPayload,UpdateFlowJsonOptions,UpdateFlowJsonResponse,FlowAsset,FlowAssetList,FlowPreview,FlowJsonInput,ListFlowsOptions, andGetPreviewOptions, plus theFlowsResourceclass. - Block API via
client.blocks(phone-number-scoped, defaults to the configuredphoneNumberId):block,unblock, andlist.block/unblockaccept up to 1000 users per call and reject an empty or over-limit array withWhatsAppValidationErrorbefore any request. Note:unblockis aDELETEwith a JSON body (sent correctly by the HTTP core), only users who messaged the business in the last 24 hours can be blocked, and per-user failures surface inblock_users.failed_userseven when the overall call succeeds. New exported typesBlockedUser,FailedBlockUser,BlockUsersResponse,BlockedUserList, andListBlockedUsersOptions, plus theBlocksResourceclass. - Calling settings and lifecycle via
client.calls(phone-number-scoped, defaults to the configuredphoneNumberId):getSettings,updateSettings,initiate,preAccept,accept,reject, andterminate.updateSettingssends{ calling: {...} }with camelCase→snake_case mapping and passescallHours/sipthrough unchanged; the lifecycle methods POST to{id}/callswith the matchingaction. Scope note: the WhatsApp Business Calling API SDP/WebRTC (and SIP) media plane is OUT OF SCOPE. This SDK wraps the REST signaling + settings endpoints only — the caller owns the WebRTC/SIP media stack, and SDP offers/answers are passed through as opaque strings (never parsed or validated). New exported typesCallSdp,CallingSettings,PhoneNumberSettings,CallingSettingsUpdate,UpdateCallSettingsPayload,InitiateCallOptions, andCallResponse, plus theCallsResourceclass.
1.1.0 - 2026-10-09
Section titled “1.1.0 - 2026-10-09”Changed
Section titled “Changed”- Expanded the npm package
descriptionandkeywordsto improve discoverability on npm and in search/LLM results — the metadata now names the concrete capabilities (send messages, media, templates, interactive messages; verify webhooks; manage phone numbers, WABAs, and templates) and the runtime (zero dependencies, native fetch, Node.js 20+). No code or API changes. - Documentation (
README): added a “Why this library” positioning section, a “What you can do” capability table, and an FAQ answering common questions (how to send a message/template, how to verify webhooks, dependencies, supported Node.js versions, official-SDK clarification). Existing usage sections are unchanged.
First stable release. The public API is now considered stable and this project follows Semantic Versioning: breaking changes will only ship in a new major version.
Version
1.0.0is skipped: a1.0.0was published to npm long before this SDK’s current line and later unpublished, and npm permanently reserves unpublished version numbers.1.0.1is therefore the first stable (1.x) release on npm.
Stable surface
Section titled “Stable surface”No functional changes from 0.5.0 — this release marks the existing feature set
as stable:
- Outbound messaging — text, media (image/video/audio/document/sticker), location, contacts, templates, interactive (buttons, lists, CTA URL, flow, location request, product, product list, address message), reactions, mark-as-read, and typing indicator; every sender supports reply threading via
replyToMessageId. - Inbound webhooks — GET verification handshake, constant-time
X-Hub-Signature-256validation, and typed parsing of incoming messages (includingnfm_reply) and status updates. - Media lifecycle — upload, URL resolution, download, and delete.
- Phone number & WABA management —
client.phoneNumbersandclient.waba. - Message-template management —
client.templates(list/get/create/edit/delete). - Typed errors — the full error hierarchy plus the
WhatsAppErrorCodeconstants map. - Client-side validation of documented API limits, raised before the request.
Changed
Section titled “Changed”- Documentation updated to reflect stable
1.xstatus (README status note and SECURITY supported-versions table).
0.5.0 - 2026-10-09
Section titled “0.5.0 - 2026-10-09”- Message-template management via
client.templates:list(GET {WABA_ID}/message_templateswith optionalfields,limit,name,status,category,language, andafter/beforepaging cursors),get(GET {TEMPLATE_ID}with optional field selection),create(POST {WABA_ID}/message_templates),edit(POST {TEMPLATE_ID}for the editablecategory/components/messageSendTtlSecondsfields;nameandlanguageare immutable and editing an approved template resets it toPENDING), anddelete(DELETE {WABA_ID}/message_templates?name=..., optionally scoped to one version viahsm_id). The list/create/delete methods accept an optional trailingbusinessAccountIdand fall back to the configuredbusinessAccountId;get/editare scoped by a required template id.createvalidates the documented hard limits client-side before sending: name is lowercase alphanumeric plus underscores and at most 512 chars, a non-empty language and a valid category are required, components must be non-empty with exactly one BODY and at most one each of HEADER/BODY/FOOTER, BODY text ≤ 1024, HEADER/FOOTER text ≤ 60, and a BUTTONS component holds at most 10 buttons. - New exported types for template management:
TemplateCategory,TemplateStatus,TemplateParameterFormat,MessageTemplateComponent(the management-side component union, aliased to avoid colliding with the send-sideTemplateComponent),TemplateButton,TemplateNamedParamExample,MessageTemplate,CreateTemplatePayload,EditTemplatePayload,TemplateList,CreateTemplateResponse, plus theTemplatesResourceclass and itsListTemplatesOptions/DeleteTemplateOptionsoption types.
0.4.0 - 2026-10-08
Section titled “0.4.0 - 2026-10-08”- Ergonomic Graph error-code constants via the exported
WhatsAppErrorCodemap and itsWhatsAppErrorCodeValuetype, so callers can compareerr.codeagainst named constants (e.g.WhatsAppErrorCode.RE_ENGAGEMENT_MESSAGE) instead of magic numbers. The map covers the common auth, permission, rate-limit, re-engagement, template, media, and phone-number codes, and is now the single source of truth for the auth/rate-limit/re-engagement code sets used byerrorFromResponse— error-class mapping behavior is unchanged. - Phone-number management via
client.phoneNumbers:get(phone number details with optional field selection),requestVerificationCodeandverifyCode(the SMS/voice verification flow),registerandderegister(Cloud API registration with a six-digit PIN and optional data-localization region),setTwoStepPin(set/change the two-step PIN; there is no API to disable it), andgetBusinessProfile/updateBusinessProfilefor the WhatsApp Business Profile. Each method accepts an optional trailingphoneNumberIdoverride and falls back to the configuredphoneNumberId. New exported typesPhoneNumber,BusinessProfile,BusinessProfileUpdate,BusinessProfileVertical,RequestVerificationCodeOptions, andRegisterOptions. - WhatsApp Business Account (WABA) management via
client.waba:get(account details),listPhoneNumbers(the numbers owned by the account, with paging),listSubscribedApps,subscribeApp, andunsubscribeApp. Each method accepts an optional trailingbusinessAccountIdoverride and falls back to the configuredbusinessAccountId. New exported typesWaba,SubscribedApp,SubscribedAppList,PhoneNumberList,Paging,PagingCursors,ListPhoneNumbersOptions, and the sharedSuccessResponse.
0.3.1 - 2026-10-08
Section titled “0.3.1 - 2026-10-08”- npm publish failed provenance validation with
E422becausepackage.jsonURLs used the lowercase ownersolvejetwhile the signed provenance (from the GitHub OIDC claim) uses the canonicalSolveJet; npm requiresrepository.urlto match the provenance exactly, case-sensitively. Correctedrepository.url,homepage,bugs.url, and the contributor URL toSolveJet. This is the first version actually published to npm with provenance;0.3.0was tagged and released on GitHub but never reached npm due to this error.
0.3.0 - 2026-10-08
Section titled “0.3.0 - 2026-10-08”Note:
0.3.0was tagged and released on GitHub but never published to npm — its publish failed provenance validation (see0.3.1). The features below ship in0.3.1.
- Typing indicator via
client.messages.sendTypingIndicator(messageId, phoneNumberId?): marks an inbound message as read and shows atyping_indicatorof typetextto the user (dismissed when you send a message or after about 25 seconds). The existingmarkAsReadsignature is unchanged. - Interactive address message via
client.messages.sendAddressMessage(supported in India and Singapore): a typedAddressMessagePayload(body, requiredcountryofIN/SG, optional pre-filledvalues,savedAddresses,validationErrors, plus the shared header/footer) whose camelCase fields map to the snake_case API shape and are serialized into the JSON-encodedaction.parametersstring the API requires. Client-side validation rejects a missing/unsupported country, anin_pin_code/sg_post_codelonger than 6 characters, and over-limit body/footer/header lengths. New exported typesAddressMessagePayload,AddressMessageValues, andAddressMessageSavedAddress. - Inbound parsing for address submissions: the interactive webhook union now carries
nfm_reply(Native Flow Message reply) withname, the RAWresponse_jsonstring (left unparsed so a malformed payload never throws — callersJSON.parseit), and an optionalbody. New exported typeInteractiveNfmReply.
- Release workflow: npm OIDC trusted publishing now works end to end. The publish was failing with a misleading
ENEEDAUTH; the actual cause was a case mismatch in the npm trusted-publisher config (solvejetvs the canonical GitHub ownerSolveJet), which made npm’s token exchange return404 package not found. The workflow now uses Node 24’s bundled npm, keepsregistry-urlwhile stripping the empty_authTokenline setup-node writes, never setsNODE_AUTH_TOKEN, and gained aworkflow_dispatchtrigger for manual re-runs. Trusted-publisher field names are case-sensitive and must match the GitHub OIDC claims exactly.
0.2.0 - 2026-10-07
Section titled “0.2.0 - 2026-10-07”- Media API via
client.media:upload(multipart upload of aBlob/Fileor raw bytes with an explicit content type, returning a reusable mediaid),getUrl(typedMediaInfowith a short-lived download URL),download/downloadByUrl(fetch the bytes as aUint8Arraywith the bearer token and aUser-Agent), anddelete. Each method accepts an optionalphoneNumberIdoverride. - HTTP core support for the media lifecycle: multipart
FormDatarequest bodies (no manualContent-Type, sofetchsets the boundary), binary responses (responseType: 'binary'returning aUint8Array), absolutehttp(s)download targets used verbatim instead of the base URL, and an optionalUser-Agentheader. Non-idempotent multipart uploads run as a single attempt (an unreplayable body is never retried); idempotentGET/DELETEand downloads still follow the retry policy. Error responses always parse the Graph envelope and throw a typed error — binary callers never receive partial bytes on failure. - A dependency-audit CI job that runs
pnpm audit --audit-level high, failing the build only on high/critical advisories.
Changed
Section titled “Changed”- Upgraded
vitestand@vitest/coverage-v8to v5, resolving the transitivetinypoolcritical advisories (GHSA-85c8-ppgw-ccpr, GHSA-5gmw-xhrv-c9v3); vitest 5 no longer depends on the affectedtinypool. - CI dev-tooling checks (lint, typecheck, test, build) now run on Node 22 and 24, since vitest 5 requires Node >= 22.12. The published package continues to support Node 20 (
engines.nodestays>=20), verified by a dedicated job that imports the built ESM and CJS artifacts on Node 20.
0.1.0 - 2026-10-07
Section titled “0.1.0 - 2026-10-07”- Project foundation: TypeScript 6 toolchain, tsup dual ESM/CJS build, vitest, ESLint 10 flat config, and Prettier.
- Minimal
WhatsAppClientskeleton pinned to Graph APIv23.0. - HTTP core built on native
fetch/AbortControllerwith per-attempt timeout, retries on 429/5xx/network errors using jittered exponential backoff (honoringRetry-After), and a typed error hierarchy (WhatsAppApiError,WhatsAppAuthenticationError,WhatsAppRequestError,WhatsAppValidationError). - Typed outbound Messages API via
client.messages:sendText,sendImage,sendVideo,sendAudio,sendDocument,sendSticker,sendLocation,sendContacts,sendTemplate,sendInteractiveButtons,sendInteractiveList,sendReaction, andmarkAsRead. - Reply/context support: every sender accepts a trailing
SendOptionswithreplyToMessageId, injecting a root-levelcontext: { message_id }into the request body. - Five new interactive senders:
sendInteractiveCtaUrl,sendInteractiveFlow,sendLocationRequest,sendProduct, andsendProductList. - Rich interactive headers for buttons and lists: a plain string, a structured text header, or an image/video/document media header (
InteractiveHeader,InteractiveMediaHeader). - Full contacts object:
ContactNamemiddle name/suffix/prefix plusContactAddress,ContactOrg,ContactUrl, andContactaddresses/org/urls/birthday. - Client-side validation of documented Messages API limits (text/interactive body, footer, header, button counts and ids, list sections/rows, reaction emoji, flow CTA, product-list items), raising
WhatsAppValidationErrorwith a field + limit message; nothing is truncated. - Typed errors
WhatsAppRateLimitError(exposingretryAfterMswhen aRetry-Afterheader is present) andWhatsAppReEngagementError, both subclasses ofWhatsAppApiError;errorFromResponsemaps429/130429/131056/133016to rate-limit and131047to re-engagement. - Framework-agnostic webhooks module: GET verification handshake (
verifyWebhook,verifyWebhookQuery) echoing the rawhub.challengewith a constant-time token check; constant-timeX-Hub-Signature-256validation over the raw request body (verifySignature); typed inbound parsing (parseWebhook,extractMessages,extractStatuses,isMessageEvent/isStatusEvent) with a discriminatedIncomingMessageunion (text, image, video, audio, document, sticker, location, contacts, interactive, button, reaction, plus an unknown fallback) andMessageStatus; aWebhookHandlerthat binds the verify token and App Secret; and a newWhatsAppWebhookError. - CI (Node 20 and 22) and release-on-tag workflows.
- OSS docs: README, LICENSE, CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, CODEOWNERS.
Changed
Section titled “Changed”- Interactive button and list headers now accept the structured
InteractiveHeadertype in addition to a plain string (backward compatible). - Removed stale “omitted” notes from the contact types now that the full contacts object is modeled.
Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.