Documentation

modelriver listen

Receive webhook events via WebSocket: no public URL or ngrok required. Like `stripe listen` for AI workflows.

Overview

The listen command connects to ModelRiver via WebSocket and receives webhook events in real-time. Unlike traditional webhooks that require a publicly accessible URL, this approach works entirely through WebSocket: no ngrok, no public URL, no firewall configuration.

Usage

Bash
# Start listening for webhooks (like `stripe listen`)
modelriver listen --print
 
# Forward to local server
modelriver listen --port 3001 --print
 
# With custom API key
modelriver listen --api-key mr_live_YOUR_KEY --print
 
# Forward to external server (without starting local server)
modelriver listen --port 3002 --forward --print

How it works

  1. Authenticates with your API key
  2. Gets a secure WebSocket token (valid for 24 hours)
  3. Connects to ModelRiver via WebSocket
  4. Receives webhook events in real-time: no public URL or ngrok required!
  5. Optionally forwards to local server

Example output

Connecting to ModelRiver...
WebSocket connected
Joined webhook channel
 
> Ready! Listening for webhook events
> User ID: user-id-123
> Channel: cli_webhooks:user-id-123
> Local port: 3001
 
> Press Ctrl+C to stop
 
[2026-01-07 15:20:30] Webhook received via WebSocket:
Channel ID: abc-123-def
Status: success
Data: {"result": "..."}

Options

OptionDescription
--printPrint received webhooks to console
--port <number>Local server port to forward to
--forwardEnable forwarding to local server
--api-key <key>ModelRiver API key
--verboseShow detailed logs

Next steps