@polymorfa/sdk is the Polymorfa server SDK for TypeScript and JavaScript. It
has no runtime dependencies and ships its own type definitions.
Requirements
- Node.js 20 or later, or a server-side Cloudflare Worker, Deno, or Bun. The
runtime must provide
fetchandcrypto.subtle. - A team key (
pmfa_…) or project credential (pmfa_pt_…). Create one under API keys.
Install
dev tag. There is
no stable release yet. The exact-version flag records the resolved version, such
as 0.1.0-dev.20261001215108, so every install gets the same code. Commit your
lockfile.
The dev tag moves each time a new prerelease is published. Read the
version notes before you upgrade.
Make your first request
Store your key in thePOLYMORFA_KEY environment variable, then list your
Numbers:
sessions:read permission.
Send a message
messages:write. The Number must be connected. See
Send and receive messages for media, templates, and
replies.
Use an edge runtime
Import from the package root,@polymorfa/sdk, in Cloudflare Workers, Deno, and
Bun. Keep keys in the runtime’s secret store, not in source code.
@polymorfa/sdk/node contains file download helpers that need Node.js. Do not
import it in edge code.
See Verify a webhook for a Worker
that receives webhooks.
Next steps
- Create a client: pick the right client and set timeouts, retries, and the API version.
- Errors and retries: handle failures and read every page of a list.
- Connect and manage Numbers: connect a WhatsApp account with QuickLink.
- Analytics: read engagement, call outcomes and activity intervals, or export collector metrics.