This document shows real-world usage examples of the enhanced WebhookStash CLI with interactive mode.
$ webhookstash connect --port 3000What happens:
╦ ╦┌─┐┌┐ ┬ ┬┌─┐┌─┐┬┌─╔═╗┌┬┐┌─┐┌─┐┬ ┬
║║║├┤ ├┴┐├─┤│ ││ │├┴┐╚═╗ │ ├─┤└─┐├─┤
╚╩╝└─┘└─┘┴ ┴└─┘└─┘┴ ┴╚═╝ ┴ ┴ ┴└─┘┴ ┴
It looks like this is your first time using webhookstash CLI.
Opening a browser so you can log in and choose a project...
Opening browser to authenticate...
If your browser doesn't open automatically, visit:
http://localhost:8080/cli/auth?device_code=abc123
Waiting for authentication...
✓ Successfully configured project: My Production App
Project: My Production App
Target: http://localhost:3000
Server: ws://localhost:8080
Connecting to WebhookStash...
✓ Connected to WebhookStash
✓ Forwarding webhooks to http://localhost:3000
Waiting for webhooks... (Press Ctrl+C to stop)
[15:04:05] stripe.payment_intent.succeeded → 200 OK (45ms)
$ webhookstash connectWhat happens:
╦ ╦┌─┐┌┐ ┬ ┬┌─┐┌─┐┬┌─╔═╗┌┬┐┌─┐┌─┐┬ ┬
║║║├┤ ├┴┐├─┤│ ││ │├┴┐╚═╗ │ ├─┤└─┐├─┤
╚╩╝└─┘└─┘┴ ┴└─┘└─┘┴ ┴╚═╝ ┴ ┴ ┴└─┘┴ ┴
Project: My Production App
Target: http://localhost:3000 # Uses last port automatically
Server: ws://localhost:8080
Connecting to WebhookStash...
✓ Connected to WebhookStash
✓ Forwarding webhooks to http://localhost:3000
Waiting for webhooks... (Press Ctrl+C to stop)
Note: No browser popup, connects immediately using saved credentials.
$ webhookstashOutput:
╦ ╦┌─┐┌┐ ┬ ┬┌─┐┌─┐┬┌─╔═╗┌┬┐┌─┐┌─┐┬ ┬
║║║├┤ ├┴┐├─┤│ ││ │├┴┐╚═╗ │ ├─┤└─┐├─┤
╚╩╝└─┘└─┘┴ ┴└─┘└─┘┴ ┴╚═╝ ┴ ┴ ┴└─┘┴ ┴
Connected to: My Production App
Common commands:
webhookstash connect [--port 3000] Connect your local dev server
webhookstash projects List and switch projects
webhookstash logout Clear local credentials
Run 'webhookstash --help' for more information.
$ webhookstash projectsOutput:
Your projects:
● My Production App (default)
ID: proj_abc123
Token: tok_****789
Staging Environment
ID: proj_def456
Token: tok_****123
Development Project
ID: proj_xyz999
Token: tok_****000
$ webhookstash projects switch proj_def456
✓ Switched to project: Staging Environment$ webhookstash connectConnects to "Staging Environment" automatically.
$ webhookstash connect --project proj_xyz999name: Integration Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install WebhookStash CLI
run: go install github.com/aivaras/webhookstash-cli/cmd/webhookstash@latest
- name: Start webhook tunnel
run: |
webhookstash connect \
--project ${{ secrets.WEBHOOKSTASH_PROJECT_ID }} \
--token ${{ secrets.WEBHOOKSTASH_TOKEN }} \
--port 3000 \
--no-browser &
env:
WEBHOOKSTASH_API_BASE_URL: https://api.webhookstash.com
- name: Run tests
run: npm testKey points:
--no-browserflag prevents browser popup in headless environment- Fails fast if credentials are missing
- Perfect for CI/CD pipelines
FROM golang:1.21-alpine
# Install WebhookStash CLI
RUN go install github.com/aivaras/webhookstash-cli/cmd/webhookstash@latest
# Your app
COPY . /app
WORKDIR /app
CMD ["sh", "-c", "webhookstash connect --project $PROJECT_ID --token $TOKEN --port 3000 --no-browser & npm start"]version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- PROJECT_ID=proj_abc123
- TOKEN=tok_xyz789
- WEBHOOKSTASH_API_BASE_URL=https://api.webhookstash.com# Uses local WebhookStash backend
export WEBHOOKSTASH_API_BASE_URL=http://localhost:8080
webhookstash connect --port 3000# Points to staging backend
export WEBHOOKSTASH_API_BASE_URL=https://staging.webhookstash.com
webhookstash connect --port 3000# Points to production backend
export WEBHOOKSTASH_API_BASE_URL=https://api.webhookstash.com
webhookstash connect --port 3000$ webhookstash logout
Logging out from project: My Production App
✓ Successfully logged out
Run 'webhookstash connect' to log in again.Next webhookstash connect will trigger browser auth again.
$ webhookstash connect --no-browser
Error: no project configured and --no-browser is set. Provide --project and --token, or remove --no-browser$ webhookstash connect --project proj_123 --no-browser
Error: project proj_123 not found in config. Remove --no-browser to authenticate, or provide --token$ webhookstash connect --project proj_123 --token tok_456 --port 3000 --no-browser
# ✓ Works! Connects without config or browser# Production app runs on 3000
webhookstash connect --project proj_production --port 3000
# Staging app runs on 4000
webhookstash connect --project proj_staging --port 4000
# Development app runs on 5000
webhookstash connect --project proj_development --port 5000The CLI remembers the last used port, but you can always override it.
$ webhookstash connect --port 3000 -vOutput includes response bodies:
[15:04:05] stripe.payment_intent.succeeded → 200 OK (45ms)
Response: {"status":"success","id":"evt_123"}
[15:04:12] github.push → 500 Internal Server Error (120ms)
Response: {"error":"Database connection failed"}
webhookstash connect --project proj_123 --token tok_456 --port 3000# First time: browser opens, you authenticate
webhookstash connect --port 3000
# Subsequent times: just connect
webhookstash connectBoth approaches work! Choose what fits your workflow.
# Connect to a different project temporarily (doesn't change default)
webhookstash connect --project proj_staging
# Change default permanently
webhookstash projects switch proj_stagingThe CLI remembers your last used port:
# First run
webhookstash connect --port 8080
# Next run - uses 8080 automatically
webhookstash connectShare a .envrc file with your team:
# .envrc
export WEBHOOKSTASH_API_BASE_URL=https://staging.webhookstash.comEveryone uses:
source .envrc
webhookstash connectwebhookstash # No arguments shows statusThe new interactive CLI makes local development frictionless while preserving the scriptable explicit mode for automation. Choose the mode that fits your use case:
- Local dev: Use interactive mode (
webhookstash connect) - CI/CD: Use explicit mode with
--no-browser - Scripts: Use
--project,--token, and--no-browserflags
Backward compatible with all existing workflows!