Skip to main content
The Twilio adapter reads the Programmable Voice, Messaging (SMS and WhatsApp) and, in TypeScript, Conversations webhooks: it checks X-Twilio-Signature, finds the customer’s handle, the call or thread id and what the carrier attested, and records the inbound turn. It never answers TwiML: the reply belongs to your agent.

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

Both SDKs check the signature the way Twilio computes it: the Base64 HMAC-SHA1, with your auth token, of the full URL Twilio called followed by every POST parameter, sorted by name.

Minimal example

The same code is in examples/twilio_voice.py and examples/twilio-voice.ts.

Limits

  • A request without the right signature returns None (Python) or no request (TypeScript): answer 403 and record nothing.
  • The adapter produces no TwiML and connects no call: connect_your_voice_agent() in the example is your code.
  • The signature covers the full URL Twilio called; behind a proxy that changes the host or the scheme, pass the public URL.
  • Tested with recorded payloads and signatures computed in the test; no Twilio account is needed.

Next steps

Voice agents

the carrier’s attestation and what each level releases.

Pipecat

a voice pipeline over Twilio Media Streams.