tunnel Command

Last updated October 18, 20265 min read

Forward webhooks to localhost from the CLI

The quickest way to forward webhooks to localhost from the command line is a tunnel CLI. Install the Hooklistener CLI, run hooklistener login once, then hooklistener tunnel --port 3000. You get a public HTTPS URL that forwards each request to your local server and keeps a copy you can inspect and replay.

terminal
npm i -g hooklistener        # or: brew tap hooklistener/tap && brew install hooklistener
hooklistener login           # one-time browser sign-in
hooklistener tunnel --port 3000
# Public URL: https://abc123.hook.events → http://localhost:3000

The tunnel command creates a public HTTPS URL that tunnels all traffic to your local development server. This is the fastest way to test webhooks from services like Stripe, GitHub, Slack, and more. If you'd rather give the provider a URL that never changes, use listen with a hosted endpoint instead.

Most Used Command

This is the most commonly used CLI command. Start your local server, run hooklistener tunnel --port 3000, and you're ready to receive webhooks.

Usage

hooklistener tunnel --port <PORT> [OPTIONS]

Options

OptionDescription
--port <PORT>(Required) Local port to tunnel to
--host <HOST>Local host to tunnel to (default: localhost)
--subdomain <NAME>Request a specific subdomain (requires paid plan)
--scheme <SCHEME>Protocol to use locally: http or https (default: http)
--helpShow help information

How It Works

  1. Establish connection: The CLI opens a secure WebSocket connection to Hooklistener's edge servers.
  2. Get public URL: You receive a unique HTTPS URL (e.g., https://abc123.hook.events).
  3. Receive requests: Any HTTP request to your public URL is streamed to the CLI.
  4. Forward locally: The CLI forwards the request to your local server with all headers and body intact.
  5. Return response: Your server's response is sent back through the tunnel to the original caller.

Security:All traffic is encrypted with TLS. Your local server never needs to be directly exposed to the internet.

Examples

Basic Tunnel

Expose localhost:3000 with a public URL:

hooklistener tunnel --port 3000

Output:

✓ Tunnel established

  Public URL: https://abc123.hook.events
  Forwarding: https://abc123.hook.events → http://localhost:3000

  Ready to receive webhooks. Press Ctrl+C to stop.

Custom Subdomain

Request a memorable subdomain (paid plans):

hooklistener tunnel --port 3000 --subdomain my-app

This gives you https://my-app.hook.events — useful for webhook configurations you don't want to update frequently.

Tunnel to Docker Container

Forward to a service running in Docker:

hooklistener tunnel --port 8080 --host host.docker.internal

Local HTTPS Server

If your local server uses HTTPS:

hooklistener tunnel --port 3000 --scheme https

Checked September 2026

Hooklistener vs ngrok http vs hookdeck listen

All four commands forward webhooks to a local port. They differ in which URL the provider sees and what happens to a request after it arrives.

CLI commands for forwarding webhooks to localhost, compared as of September 2026
Criteriahooklistener tunnelhooklistener listenngrok httphookdeck listen
Commandhooklistener tunnel --port 3000hooklistener listen YOUR_ENDPOINT_SLUG --target http://localhost:3000ngrok http 3000hookdeck listen 3000 <source>
URL you give the providerRandom hook.events subdomain on Free; a static subdomain on paid plansYour hosted endpoint URL, which doesn't change, on Free too1 static dev domain on FreeA permanent event URL per source
When your machine is offlineRequests aren't delivered while the tunnel is closedThe endpoint still captures requests; replay them laterRequests aren't delivered while the agent is stoppedNot documented
History and replayStored in the cloud: 1 day on Free, up to 90 days on Scale; replay to localhostStored in the cloud: 1 day on Free, up to 90 days on Scale; replay to localhostTraffic Inspector, 24-hour retention on Free; replay needs opt-in Full CaptureCLI Events page and local retry (not in guest mode)
Free tier1 CLI tunnel at a time, 50 stored requests1 hosted endpoint, 50 stored requests20,000 HTTP requests/mo, 1 GB transfer; interstitial page on HTTP endpointsDeveloper plan: 10,000 events/mo, 3-day retention
Pick it whenYou want a public URL for a local port right nowYou want a provider URL that never changes and no lost webhooksYou also need TCP/TLS tunnels or non-webhook trafficYou already route production events through Hookdeck

Sources: ngrok pricing, ngrok Traffic Inspector, Hookdeck CLI docs, Hookdeck pricing, Hooklistener pricing.

Common Integrations

Once your tunnel is running, configure these services with your public URL:

  • Stripe: Dashboard → Developers → Webhooks → {tunnel_url}/stripe/webhook
  • GitHub: Repo Settings → Webhooks → {tunnel_url}/github/events
  • Slack: App Settings → Event Subscriptions → {tunnel_url}/slack/events
  • Twilio: Phone Number → Messaging → {tunnel_url}/twilio/sms

Tip:Check out our integration guides for step-by-step instructions: Stripe, GitHub, Slack

Troubleshooting

Connection refused

Make sure your local server is running on the specified port. The tunnel forwards requests, but they'll fail if nothing is listening.

Tunnel disconnects frequently

This usually indicates network instability. Check your internet connection, VPN, or firewall settings. The CLI will attempt to reconnect automatically.

Subdomain already taken

Custom subdomains are first-come, first-served. Choose a different subdomain or upgrade to a plan with reserved subdomains.

  • listen — Forward from an existing endpoint instead of creating a new URL
  • tui — View tunnel traffic in the interactive UI
  • login — Authenticate before creating tunnels