Install
@niadra/sdk on npm.
The five primitives
subscribe() (Python) and whatsAppChallenge() (TypeScript) answer Meta’s subscription challenge on the GET.
Minimal example
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 toupload_media()and pass the result asupload=(with yourtranscript=of a voice note). The text of a PDF, an image or an Office file (DOCX, XLSX, PPTX) is read inside the cell only, and only when the space lists the type inmedia.extract_text_from; the type comes from the bytes, never from the declared MIME type. All reading happens in the models server, in one child process per document, one at a time: the PDF’s text layer, and OCR (RapidOCR with the PP-OCRv6 small recognizer) of the image, scaled down, and of each scanned PDF page, rendered at 200 dpi; a macro-enabled Office file is refused. A file that fails (413 or 422) is treated as a file without text, and no file leaves the region. The text keeps its line breaks, passes the redactor before extraction and becomes a derived turn. - Each
WhatsAppMessagecarries thewa_idand, 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.

