Install
@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
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 or an image is read inside the cell only, and only when the space lists the type inmedia.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
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.

