Skip to main content

Why ngrok is Required

Twilio, Vonage, and Exotel use a two-step call setup:
  1. They send an HTTP POST webhook to your server when a call arrives
  2. They open a WebSocket to your server to stream bidirectional audio
Both connections come from the provider’s cloud to your machine. During local development your machine is not publicly reachable, so you need ngrok to create an HTTPS tunnel.
You need a single ngrok tunnel pointing to port 8080 (the Nginx gateway). All webhook and WebSocket traffic flows through Nginx and is proxied to assistant-api.

Prerequisites


Step-by-Step Setup

1

Install and authenticate ngrok

Sign in and set your authtoken (required for stable subdomains):
Get your authtoken at dashboard.ngrok.com/get-started/your-authtoken.
2

Start the tunnel

ngrok outputs a forwarding URL like:
Copy the https:// URL — this is your PUBLIC_ASSISTANT_HOST.
The free tier generates a random URL on each restart. To get a stable URL across restarts, use a paid ngrok plan with a reserved domain.
3

Update PUBLIC_ASSISTANT_HOST in assistant-api

Edit docker/assistant-api/.assistant.env:
4

Update media URL in the UI config

Edit ui/src/configs/config.development.json:
The media field is the public URL the browser and telephony providers use for WebSocket connections.
5

Restart assistant-api and the UI

If running the UI in development mode:
6

Verify the tunnel is proxying correctly

You can also check the ngrok web inspector at http://localhost:4040 to see incoming requests in real time.

Configuring Twilio for Local Testing

With ngrok running, point your Twilio phone number’s webhook to:
  1. Open Twilio Console → Phone Numbers → Active Numbers
  2. Select your number
  3. Under Voice Configuration, set:
  1. Call the number — Twilio posts the webhook to ngrok, which forwards to your local assistant-api

Configuring Vonage for Local Testing

Point your Vonage Application’s Answer URL to:
  1. Open Vonage Dashboard → Applications → select your app
  2. Under Capabilities → Voice → Answer URL, set the URL above
  3. Set Event URL to: https://abc123.ngrok-free.app/v1/talk/vonage/ctx/{contextId}/event

Configuring Exotel for Local Testing

In your Exotel App (applet), set the webhook URL to:

Two Configurations Always Need Updating

When your ngrok URL changes (e.g., after a free-tier restart), update both of these: Then restart:

Using a random URL is inconvenient for team development since the webhook URL in Twilio/Vonage must be updated every time ngrok restarts. Options for a stable URL: With a static/reserved domain, you set the webhook URL in Twilio/Vonage once and never update it.

Troubleshooting

The Rapida stack is not running. Verify:
PUBLIC_ASSISTANT_HOST is still set to the old ngrok URL or to localhost. Update it to the new ngrok hostname and run make rebuild-assistant.
The tunnel is not running. Start it again:
And update both PUBLIC_ASSISTANT_HOST and connection.media with the new URL.
Twilio requires HTTPS. ngrok provides HTTPS automatically. Do not use the http:// version of the URL — always use the https://abc123.ngrok-free.app URL in Twilio’s console.

Next Steps

Telephony Setup

Full provider setup — Twilio, Vonage, Exotel, Asterisk, SIP.

Configuration

All PUBLIC_ASSISTANT_HOST and SIP variables.