Skip to main content
The WhatsApp Cloud API adapter only translates: it checks the signature of Meta’s webhook, extracts each message with the customer’s handle and the item ready to record, and records the agent’s reply from the send API’s answer. It never sends a message: your code talks to the Graph API.

Install

The TypeScript integration ships with @niadra/sdk 0.3.0, ready on main and on npm when it is published; until then the npm package is 0.1.1.

The five primitives

subscribe() (Python) and whatsAppChallenge() (TypeScript) answer Meta’s subscription challenge on the GET.

Minimal example

The same code is in examples/whatsapp_webhook.py and examples/whatsapp-cloud.ts. The flush() after record() makes the turn, and the V1 it proves, land before the first read.

Limits

  • The adapter never sends a message nor calls the Graph API; it translates the webhook and records what your code sent.
  • Media arrives as a reference (id, MIME type, SHA-256): download the bytes from the Graph API, hand them to upload_media() and pass the result as upload= (with your transcript= of a voice note). The text of a PDF or an image is read inside the cell only, and only when the space lists the type in media.extract_text_from: the PDF’s text layer in the worker, the image by OCR (RapidOCR on ONNX) in a child process of the models server, one at a time, scaled down; an image that fails (413 or 422) is treated as an image without text, and no image leaves the region. The text passes the redactor before extraction and becomes a derived turn.
  • Each WhatsAppMessage carries the wa_id and, for a WhatsApp username, the business-scoped user id (BSUID); statuses and other webhook fields are left out.
  • Tested with public payloads in Meta’s format and signatures computed in the test; no Meta account is needed.

Next steps

WhatsApp agents

identity by number, V1 from the channel and the turn the other agents read.

Twilio

WhatsApp and SMS through Twilio, with the same design.