Builders Program

Build with us for a whole month. Unlimited usage and add-ons, weekly calls and your own Slack channel.

Learn more
Polymorfa

SDKs

WhatsApp in your language, frontend to backend

Handwritten SDKs for TypeScript, Python, Go, PHP, Rust and C#, each covering the same 439 API operations. Verify webhooks, retry without duplicates and mount the inbox in your frontend with a short-lived token.

SDK languages
6
Typed operations in each SDK
439
Databases with storage adapters
9
Idempotency-Key window
24 h

In your code

The same call in every language.

Each SDK is written by hand for its language, with the same resources, errors and retry rules. Retry a send with the same key and it goes out once.

send.ts
import { MessagingClient } from "@polymorfa/sdk";

const messaging = new MessagingClient({
  credential: { type: "apiKey", value: process.env.POLYMORFA_KEY! },
});

await messaging.messages.send(
  "my-number",
  {
    conversation: { phoneNumber: "+15550001111" },
    content: { text: "Your order has shipped." },
  },
  { idempotencyKey: "order-1042-shipped" },
);

Frameworks

Fits the stack you already run.

Server code calls the API with your key. Frontend code gets a short-lived client token and the same components in every language.

  • TypeScript

    @polymorfa/sdk
    On your server
    • Node
    • Edge runtimes
    • Next.js
    • Express
    • Hono
    In your frontend
    • Browser
    • React
    • Web Components
  • Python

    polymorfa-sdk
    On your server
    • FastAPI
    • Django
    In your frontend
    • Django templates
    • HTMX
    • Inertia
  • Go

    github.com/polymorfa/sdks/packages/go
    On your server
    • net/http
    • Gin
    • Echo
    In your frontend
    • templ
    • HTMX
  • PHP

    polymorfa/sdk
    On your server
    • Laravel
    • Symfony
    In your frontend
    • Blade
    • Livewire
    • Inertia
  • Rust

    polymorfa-sdk
    On your server
    • Axum
    • Actix
    In your frontend
    • Leptos
    • Yew
  • C#

    Polymorfa.Sdk
    On your server
    • ASP.NET Core
    In your frontend
    • Blazor WebAssembly
    • MAUI

Frontend

Ship the inbox without exposing a key.

The SDKs refuse server credentials in browser and WebAssembly builds. Your server mints a client token for the signed-in user, limited to one number.

A token route in a few lines. Mint a token with clientTokens.mint on your server. The inbox fetches and refreshes its token from that route.
One inbox, every template. React components for TypeScript apps. Web Components for templ, Blade, Django templates, Razor and Yew, so there is no second UI to maintain.
Explore the UI kits

Production

Safe defaults in every SDK.

Signatures checked before parsing, retries that never duplicate a send, and typed errors that carry a code and request ID.

Webhook helpers per framework. Each one checks the HMAC signature on the raw body before it parses JSON.
Retries without duplicates. Sends create one key and reuse it on every automatic retry. A key repeated within 24 hours never sends twice.
Typed events. isEvent narrows a verified event to its payload type. Events the SDK does not know yet still verify and keep their payload.

Your data

Keep WhatsApp data in your own database.

Store chats, messages and contacts where you choose. Media and history move straight between WhatsApp and your code, so they add no storage cost.

Storage adapters. One contract writes webhooks, event streams and history into your tables. It skips duplicate events and resumes from a saved cursor after a restart. Schemas export to Drizzle, Prisma, Eloquent, Django, EF Core and SQLAlchemy.
Direct media and history. The SDK downloads and decrypts inbound media and history straight from WhatsApp, and encrypts uploads before they leave your server.

API surface

What the SDKs call for you.

Every SDK method maps to a documented REST route. The reference shows each one with a cURL example.

SDK methods

  • POST/messaging/{number}/messages/sendmessages.send
  • POST/platform/client-tokensclientTokens.mint, for browser code
  • GET/platform/projects/{project}/events/streamevents.stream, resumes from a cursor
  • GET/messaging/{number}/chatschats.list, for stored history
  • GET/messaging/media/{id}media.download, for stored media
  • POST/platform/webhooks/{id}/testswebhooks.test, sends a test delivery

Typed webhook events

  • Eventmessage.receivedSomeone wrote to the number
  • Eventmessage.ackDelivered and read receipts
  • Eventhistory.syncHistory arrived for a number
  • Eventcall.receivedA WhatsApp call is ringing
  • Eventsession.statusThe number connected or disconnected
  • Eventcampaign.recipient_repliedA campaign recipient replied

Start with a free number

Your first real number is free. Add more numbers on Pay-As-You-Go.