You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/cli/overview.mdx
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,13 +97,15 @@ Your IDE's AI assistant (Cursor, Windsurf, VSCode) gains complete, accurate know
97
97
Forward webhooks to your local server for debugging:
98
98
99
99
```bash
100
+
# Terminal 1: Create tunnel (e.g., with ngrok)
101
+
ngrok http 4242
102
+
103
+
# Terminal 2: Forward webhooks
100
104
vapi listen --forward-to localhost:3000/webhook
101
105
```
102
106
103
-
The CLI provides a public endpoint that forwards events to your local server. You'll need to update your webhook URLs in Vapi to point to this endpoint.
104
-
105
107
<Note>
106
-
Automatic webhook URL configuration (like Stripe CLI) is coming soon. For now, manually update your webhook URLs in the Vapi dashboard.
108
+
**Important:**`vapi listen` is a local forwarder only - it does NOT provide a public URL. You need a separate tunneling service (like ngrok) to expose the CLI's port to the internet. Update your webhook URLs in Vapi to use the tunnel's public URL.
107
109
</Note>
108
110
109
111
### 🔐 Multi-account management
@@ -241,7 +243,7 @@ Now that you have the Vapi CLI installed:
241
243
242
244
-**[Initialize a project](/cli/init):** Add Vapi to your existing codebase
243
245
-**[Set up MCP](/cli/mcp):** Enhance your IDE with Vapi intelligence
244
-
-**[Test webhooks locally](/cli/webhook):** Debug without external tunnels
246
+
-**[Test webhooks locally](/cli/webhook):** Debug webhooks with tunneling services
245
247
-**[Manage authentication](/cli/auth):** Work with multiple accounts
The `vapi listen` command provides a webhook forwarding service that receives events from Vapi and forwards them to your local development server. This helps you debug webhook integrations without deploying your code.
9
+
The `vapi listen` command provides a local webhook forwarding service that receives events and forwards them to your local development server. This helps you debug webhook integrations during development.
10
+
11
+
**Important:**`vapi listen` does NOT provide a public URL or tunnel. You'll need to use a separate tunneling solution like ngrok to expose your local server to the internet.
10
12
11
13
**In this guide, you'll learn to:**
12
-
- Set up local webhook forwarding
14
+
- Set up local webhook forwarding with a tunneling service
13
15
- Debug webhook events in real-time
14
16
- Configure advanced forwarding options
15
17
- Handle different webhook types
16
18
17
-
<Info>
18
-
**Note on tunneling:**Currently,`vapi listen`requires you to manually update your webhook URLs in Vapi. Automatic tunnel creation (like Stripe CLI) is coming in a future update.
19
-
</Info>
19
+
<Warning>
20
+
**No automatic tunneling:**The`vapi listen`command is a local forwarder only. It does not create a public URL or tunnel to the internet. You must use a separate tunneling service (like ngrok) and configure your Vapi webhook URLs manually.
21
+
</Warning>
20
22
21
23
## Quick start
22
24
23
25
<Steps>
26
+
<Steptitle="Set up a tunnel to your local machine">
27
+
Use a tunneling service like ngrok to create a public URL:
28
+
```bash
29
+
# Example with ngrok
30
+
ngrok http 4242 # 4242 is the default port for vapi listen
31
+
```
32
+
33
+
Note the public URL provided by your tunneling service (e.g., `https://abc123.ngrok.io`)
34
+
</Step>
35
+
24
36
<Steptitle="Start the webhook listener">
25
37
```bash
26
38
vapi listen --forward-to localhost:3000/webhook
27
39
```
28
40
29
-
Note the public URL provided in the output (e.g., `https://webhook-proxy.vapi.ai/wh_abc123def456`)
41
+
This starts a local server on port 4242 that forwards to your application
30
42
</Step>
31
43
32
44
<Steptitle="Update your webhook URLs">
33
-
Go to your Vapi Dashboard and update your webhook URLs to point to the URL from step 1:
34
-
- Assistant webhook URL
35
-
- Phone number webhook URL
45
+
Go to your Vapi Dashboard and update your webhook URLs to point to your tunnel URL:
- Phone number webhook URL: `https://abc123.ngrok.io`
36
48
- Or any other webhook configuration
37
49
</Step>
38
50
39
51
<Steptitle="Test your webhooks">
40
-
Trigger webhook events (make calls, etc.) and see them forwarded to your local server in real-time
52
+
Trigger webhook events (make calls, etc.) and see them forwarded through the tunnel to your local server
41
53
</Step>
42
54
</Steps>
43
55
44
56
## How it works
45
57
46
58
<Note>
47
-
**Current implementation:** The `vapi listen` command currently acts as a local webhook forwarder. Unlike tools like Stripe CLI, it doesn't yet create an automatic tunnel to update your Vapi webhook URLs. You'll need to manually configure your webhook URL in Vapi to point to the CLI's endpoint.
59
+
**Current implementation:** The `vapi listen` command acts as a local webhook forwarder only. It receives webhook events on a local port (default 4242) and forwards them to your specified endpoint. To receive events from Vapi, you must:
48
60
49
-
**Coming soon:** Automatic tunneling that updates your Vapi webhook configuration is planned for a future release.
61
+
1. Use a tunneling service (ngrok, localtunnel, etc.) to expose port 4242 to the internet
62
+
2. Configure your Vapi webhook URLs to point to the tunnel URL
63
+
3. The flow is: Vapi → Your tunnel URL → vapi listen (port 4242) → Your local server
50
64
</Note>
51
65
52
66
<Steps>
53
-
<Steptitle="Local server starts">
54
-
The CLI starts a webhook server on port 4242 (configurable)
67
+
<Steptitle="Local forwarder starts">
68
+
The CLI starts a webhook forwarder on port 4242 (configurable)
69
+
</Step>
70
+
71
+
<Steptitle="Tunnel exposes the forwarder">
72
+
Your tunneling service creates a public URL that routes to port 4242
55
73
</Step>
56
74
57
75
<Steptitle="Configure webhook URL">
58
-
Update your Vapi webhook URL to point to the CLI's public endpoint (provided when you start the listener)
76
+
Update your Vapi webhook URL to point to the tunnel's public URL
59
77
</Step>
60
78
61
79
<Steptitle="Events forwarded">
62
-
All webhook events are forwarded to your specified local endpoint
80
+
Webhook events flow: Vapi → Tunnel → CLI forwarder → Your local endpoint
63
81
</Step>
64
82
65
83
<Steptitle="Real-time logging">
@@ -88,6 +106,9 @@ Use a different port for the webhook listener:
88
106
```bash
89
107
# Listen on port 8080 instead of default 4242
90
108
vapi listen --forward-to localhost:3000/webhook --port 8080
109
+
110
+
# Remember to update your tunnel to use port 8080
111
+
ngrok http 8080
91
112
```
92
113
93
114
### Skip TLS verification
@@ -110,20 +131,21 @@ When you run `vapi listen`, you'll see:
110
131
$ vapi listen --forward-to localhost:3000/webhook
111
132
112
133
🎧 Vapi Webhook Listener
113
-
📡 Listening on: https://webhook-proxy.vapi.ai/wh_abc123def456
134
+
📡 Listening on: http://localhost:4242
114
135
📍 Forwarding to: http://localhost:3000/webhook
115
136
116
-
⚠️ Please update your webhook URL in Vapi to:
117
-
https://webhook-proxy.vapi.ai/wh_abc123def456
137
+
⚠️ To receive Vapi webhooks:
138
+
1. Use a tunneling service (e.g., ngrok http 4242)
139
+
2. Update your Vapi webhook URLs to the tunnel URL
118
140
119
141
Waiting for webhook events...
120
142
121
-
[2024-01-15 10:30:45] POST /webhook
143
+
[2024-01-15 10:30:45] POST /
122
144
Event: call-started
123
145
Call ID: call_abc123def456
124
146
Status: 200 OK (45ms)
125
147
126
-
[2024-01-15 10:30:52] POST /webhook
148
+
[2024-01-15 10:30:52] POST /
127
149
Event: speech-update
128
150
Transcript: "Hello, how can I help you?"
129
151
Status: 200 OK (12ms)
@@ -167,23 +189,56 @@ The listener adds helpful headers to forwarded requests:
167
189
168
190
```http
169
191
X-Forwarded-For: vapi-webhook-listener
170
-
X-Original-Host: vapi-webhooks.ngrok.io
192
+
X-Original-Host: <your-tunnel-domain>
171
193
X-Webhook-Event: call-started
172
194
X-Webhook-Timestamp: 1705331445
173
195
```
174
196
175
197
Your server receives the exact webhook payload from Vapi with these additional headers for debugging.
176
198
177
-
### Manual webhook configuration
178
-
179
-
Since automatic tunneling isn't available yet, you'll need to:
199
+
### Setting up with different tunneling services
180
200
181
-
1. Start the webhook listener and note the public URL
182
-
2. Go to your Vapi Dashboard or use the API to update webhook URLs
183
-
3. Set the webhook URL to the one provided by `vapi listen`
201
+
<AccordionGroup>
202
+
<Accordiontitle="Using ngrok">
203
+
```bash
204
+
# Terminal 1: Start ngrok tunnel
205
+
ngrok http 4242
206
+
207
+
# Terminal 2: Start vapi listener
208
+
vapi listen --forward-to localhost:3000/webhook
209
+
210
+
# Use the ngrok URL in Vapi Dashboard
211
+
```
212
+
</Accordion>
213
+
214
+
<Accordiontitle="Using localtunnel">
215
+
```bash
216
+
# Terminal 1: Install and start localtunnel
217
+
npm install -g localtunnel
218
+
lt --port 4242
219
+
220
+
# Terminal 2: Start vapi listener
221
+
vapi listen --forward-to localhost:3000/webhook
222
+
223
+
# Use the localtunnel URL in Vapi Dashboard
224
+
```
225
+
</Accordion>
226
+
227
+
<Accordiontitle="Using cloudflared">
228
+
```bash
229
+
# Terminal 1: Start cloudflare tunnel
230
+
cloudflared tunnel --url http://localhost:4242
231
+
232
+
# Terminal 2: Start vapi listener
233
+
vapi listen --forward-to localhost:3000/webhook
234
+
235
+
# Use the cloudflare URL in Vapi Dashboard
236
+
```
237
+
</Accordion>
238
+
</AccordionGroup>
184
239
185
240
<Tip>
186
-
**Future enhancement:**We're working on automatic webhook URL updates, similar to how Stripe CLI works. This will eliminate the manual configuration step.
241
+
**Pro tip:**Some tunneling services offer static URLs (like ngrok with a paid plan), which means you won't need to update your Vapi webhook configuration every time you restart development.
187
242
</Tip>
188
243
189
244
### Filtering events
@@ -218,22 +273,38 @@ The listener expects standard HTTP responses:
218
273
```
219
274
</Step>
220
275
221
-
<Steptitle="Start webhook listener">
276
+
<Steptitle="Start tunnel to expose port 4242">
222
277
```bash
223
278
# In terminal 2
279
+
ngrok http 4242 # Creates public URL for the CLI listener
280
+
# Note the public URL (e.g., https://abc123.ngrok.io)
281
+
```
282
+
</Step>
283
+
284
+
<Steptitle="Start webhook listener">
285
+
```bash
286
+
# In terminal 3
224
287
vapi listen --forward-to localhost:3000/api/vapi/webhook
225
288
```
226
289
</Step>
227
290
291
+
<Steptitle="Configure Vapi webhooks">
292
+
Update your Vapi webhook URLs to point to the ngrok URL from step 2
293
+
</Step>
294
+
228
295
<Steptitle="Make test calls">
229
296
Use the Vapi dashboard or API to trigger webhooks
230
297
</Step>
231
298
232
299
<Steptitle="Debug in real-time">
233
-
See events in both terminals and debug your handler
300
+
See events in the CLI terminal and debug your handler
234
301
</Step>
235
302
</Steps>
236
303
304
+
<Note>
305
+
**Data flow:** Vapi sends webhooks → Ngrok tunnel (public URL) → vapi listen (port 4242) → Your local server (port 3000)
Use the Vapi CLI to forward webhooks to your local development server:
129
126
130
127
```bash
128
+
# Terminal 1: Create tunnel (e.g., with ngrok)
129
+
ngrok http 4242
130
+
131
+
# Terminal 2: Forward webhooks
131
132
vapi listen --forward-to localhost:3000/webhook
132
133
```
133
134
134
-
The CLI provides a public endpoint that forwards events to your local server. You'll need to update your webhook URLs in Vapi to use this endpoint. Automatic configuration is coming soon. [Learn more →](/cli/webhook)
135
-
</Tip>
135
+
<Note>
136
+
`vapi listen` is a local forwarder that requires a separate tunneling service. Update your webhook URLs in Vapi to use the tunnel's public URL. [Learn more →](/cli/webhook)
Test webhooks locally with the Vapi CLI webhook forwarder:
14
+
Use the Vapi CLI webhook forwarder along with a tunneling service to test webhooks locally:
15
15
16
16
```bash
17
-
#Install Vapi CLI
18
-
curl -sSL https://vapi.ai/install.sh | bash
17
+
#Terminal 1: Set up tunnel (example with ngrok)
18
+
ngrok http 4242
19
19
20
-
# Start webhook forwarding
20
+
# Terminal 2: Install and run Vapi CLI
21
+
curl -sSL https://vapi.ai/install.sh | bash
21
22
vapi listen --forward-to localhost:3000/webhook
22
23
```
23
24
24
-
The CLI provides a public endpoint that forwards events to your local server. You'll need to manually update your webhook URLs in Vapi to use this endpoint.
25
-
26
25
<Note>
27
-
Unlike tools like Stripe CLI, automatic webhook URL configuration isn't available yet. This feature is coming in a future update. For now, the CLI works similarly to ngrok - providing a public URL that you configure manually.
26
+
**Important:** The `vapi listen` command is a local forwarder only - it does NOT provide a public URL or tunnel. You must use a separate tunneling service (like ngrok) to expose the CLI's port (default 4242) to the internet, then configure your Vapi webhook URLs to use the tunnel's public URL.
28
27
</Note>
29
28
30
29
[Learn more about the Vapi CLI →](/cli/webhook)
31
30
32
31
## Manual setup with ngrok
33
32
34
-
If you prefer to use ngrok or need more control over the tunneling process, follow the guide below.
33
+
If you prefer to skip the CLI and connect ngrok directly to your application, follow the guide below.
Copy file name to clipboardExpand all lines: fern/tools/custom-tools.mdx
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,15 +105,19 @@ vapi tool test <tool-id>
105
105
vapi tool delete <tool-id>
106
106
```
107
107
108
-
<Tip>
109
-
**Local development tip:** When developing custom tools, use the Vapi CLI to forward webhooks to your local server:
108
+
Use the Vapi CLI to forward tool calls to your local server:
110
109
111
110
```bash
111
+
# Terminal 1: Create tunnel (e.g., with ngrok)
112
+
ngrok http 4242
113
+
114
+
# Terminal 2: Forward events
112
115
vapi listen --forward-to localhost:3000/tools/webhook
113
116
```
114
117
115
-
The CLI provides a public endpoint that you can configure as your tool's server URL for testing. Automatic URL configuration is coming soon. [Learn more →](/cli/webhook)
116
-
</Tip>
118
+
<Note>
119
+
`vapi listen` is a local forwarder that requires a separate tunneling service. Configure your tool's server URL to use the tunnel's public URL for testing. [Learn more →](/cli/webhook)
0 commit comments