CLI

Test webhooks on your laptop,with no public URL.

The ModelRiver CLI receives your project’s webhook deliveries over a WebSocket and forwards them to a local server. Trigger requests, finish backend pipeline steps and check signatures from your terminal.

$ npm install -g @modelriver/cli

Installs the modelriver command globally.

Quick start

Three commands from install to your first webhook on localhost.

  1. 1

    Log in once

    Enter your ModelRiver API key and the local URL your app listens on. They’re saved for every later command.

    terminal
    # Saves your API key and the local URL to forward to
    modelriver login
    
    ✓ Configuration saved!
  2. 2

    Listen for deliveries

    The CLI opens a WebSocket to ModelRiver. Each webhook delivery for your project prints here and is forwarded to your local server. No tunnel needed.

    terminal 1
    modelriver listen --print
    
    ✓ WebSocket connected
    ✓ Joined webhook channel
    > Ready! Listening for webhook events
    > Local port: 3001
  3. 3

    Trigger and answer

    In a second terminal, send a test request. If the workflow has a backend pipeline step, finish it with callback.

    terminal 2
    # Send a test async request
    modelriver trigger -w support_reply -m "Where is my order?" --print-channel
    
    # Answer the waiting backend pipeline step
    modelriver callback -c 550e8400-… -d '{"status":"shipped"}'

Configure it your way

Set your API key once with login, or pass it in each time. Flags win over environment variables, which win over the config file.

config.json
// ~/.modelriver/config.json, written by modelriver login
{
  "api_key": "mr_live_…",
  "forward_url": "http://localhost:3001/webhook/modelriver"
}

A .modelriverrc file in your project works too.

Commands

Every command, with its short alias where it has one.

All commands

CommandWhat it does
loginSaves your API key and forward URL.
listen · lReceives webhook deliveries over a WebSocket and forwards them locally.
forward · fStarts forwarding with your saved settings.
trigger · tSends a test async request and prints the channel details.
callbackFinishes a waiting backend pipeline step with your data.
websocket · wsSends a request and follows its answer over a WebSocket.
test-webhookChecks webhook delivery end to end with a temporary webhook.
webhook listLists your project’s webhooks.
webhook verifyChecks a webhook signature on your machine.

Good to know

Frequently asked questions

How is this different from a tunnel like ngrok?

You don’t expose a public URL. ModelRiver sends deliveries to the CLI over a WebSocket, and the CLI passes them to your local server.

Do triggered requests count toward my plan?

Yes, like any other request, unless the workflow is in test mode.

How long does a listen session last?

The CLI’s WebSocket token is valid for 24 hours.

Can I test backend pipelines?

Yes. listen shows the delivery with its callback URL, and callback sends your backend data so the next step runs.

What do I need to install it?

Node.js 16 or later. Install the package globally from npm, then run modelriver login.

Get your first webhook on localhost

Start on the free plan, install the CLI, and run modelriver listen.