Skip to main content
@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 fetch and crypto.subtle.
  • A team key (pmfa_…) or project credential (pmfa_pt_…). Create one under API keys.
Keep keys on your server. Browser and mobile code uses a client token instead.

Install

The SDK is published as a development prerelease under the 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 the POLYMORFA_KEY environment variable, then list your Numbers:
This call needs the sessions:read permission.

Send a message

This call needs 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