Skip to main content

Documentation Index

Fetch the complete documentation index at: https://patter-06b046ce-feat-observability-otel-attrs-0-6-1.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Tunneling

Patter needs a public URL so your telephony provider can send webhooks to the local server. There are three options, all configured via the tunnel= argument on Patter() (or new Patter({ tunnel })). The built-in Cloudflare Quick Tunnel creates a public *.trycloudflare.com URL. No account or setup required — just the cloudflared binary on PATH (or the cloudflared npm package).
from getpatter import Patter, Twilio
from getpatter.tunnels import CloudflareTunnel

phone = Patter(
    carrier=Twilio(),
    phone_number="+15550001234",
    tunnel=CloudflareTunnel(),                 # auto-starts cloudflared
)
# When phone.serve() runs: "Tunnel ready: https://random-name.trycloudflare.com"
tunnel=True (Python) / tunnel: true (TypeScript) is shorthand for CloudflareTunnel():
phone = Patter(carrier=Twilio(), phone_number="+15550001234", tunnel=True)
# equivalent to tunnel=CloudflareTunnel()
You can also pass tunnel=True directly to serve():
await phone.serve(agent, tunnel=True)

Installing cloudflared

The TypeScript SDK ships the cloudflared npm wrapper as a regular dependency, so tunnel: true Just Works out of the box (npm install getpatter is enough). The Python SDK requires the cloudflared binary on your PATH — there is no Python wrapper package available. Install it once with your system package manager:
brew install cloudflared
If you pass tunnel=True (Python) without the cloudflared binary on PATH, the SDK raises a clear error with the install command you need. The legacy pip install "getpatter[tunnel]" extra is now an empty alias kept only for backwards compatibility.

Twilio webhook auto-configuration

Both SDKs automatically set the tunnel URL as the Twilio number’s voice webhook (IncomingPhoneNumber.update(voice_url=...)) on serve(), so inbound calls work out of the box — no Twilio Console configuration needed. For Telnyx, the number is associated with the configured Call Control Application (connection_id) the same way. If auto-configuration fails (for example the Twilio auth token doesn’t have permission to update the number), Patter logs a warning and prints the URL you can set manually.

Static (user-managed tunnel)

Running ngrok or some other public hostname yourself? Use Static(hostname=...) — Patter will skip process management and just trust the hostname you provide.
ngrok http 8000
from getpatter import Patter, Twilio
from getpatter.tunnels import Static

phone = Patter(
    carrier=Twilio(),
    phone_number="+15550001234",
    tunnel=Static(hostname="abc123.ngrok.io"),
)
Alternatively, pass the hostname directly as webhook_url / webhookUrl:
phone = Patter(
    carrier=Twilio(),
    phone_number="+15550001234",
    webhook_url="abc123.ngrok.io",             # no https:// prefix
)

Production

In production, point your own domain at the server:
phone = Patter(
    carrier=Twilio(),
    phone_number="+15550001234",
    webhook_url="api.yourcompany.com",
)
No tunnel needed — the telephony provider connects directly to your server.