Skip to main content

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 })).

CloudflareTunnel (dev / acceptance only)

The built-in Cloudflare Quick Tunnel creates a public *.trycloudflare.com URL with zero setup. No account required — just the cloudflared binary on PATH (or the cloudflared npm package). Warning (Twilio outbound calls): Cloudflare Quick Tunnel routes traffic through a different edge pool than Twilio’s Media Streams WebSocket upgrade path. On first outbound call, the WSS upgrade can race and drop ~1 % of calls. For production Twilio outbound use, replace this with ngrok or a pre-provisioned named Cloudflare tunnel instead.
tunnel=True (Python) / tunnel: true (TypeScript) is shorthand for CloudflareTunnel():
You can also pass tunnel=True directly to serve():

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:
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)

For production, especially with Twilio outbound calls, manage your own tunnel using ngrok or a pre-provisioned Cloudflare Named Tunnel. Patter will skip process management and trust the hostname you provide. Recommended for Twilio outbound: ngrok stabilizes the WSS upgrade path and eliminates the Quick Tunnel race. Sign up free at ngrok.com, then:
Alternatively, pass the hostname directly as webhook_url / webhookUrl:

Production

In production, point your own domain at the server:
No tunnel needed — the telephony provider connects directly to your server.