CLI
Stop tunnelling to test webhooks
Register your CommerceHook URL with the platform once. Then
listen streams every
delivery into the handler on your laptop (original method, headers
and body) while each one is also captured for the inspector.
$ npx commercehook listen my-store --forward-to http://localhost:3000/webhooks Forwarding 'my-store' to http://localhost:3000/webhooks (Ctrl-C to stop) β 200 store/order/created 6ms d5d78de1-4e17-4ddd-8be5-35ea4e3b8b67 β 200 store/cart/updated 9ms 7c2f1a90-88f1-47ab-9f2f-1f4a90b1e2c3 ! 500 store/order/updated 14ms 0a1b2c3d-4e5f-6789-abcd-ef0123456789
That ! 500 is the loop
working: your handler errored mid-edit, the CLI said so, and the
stream carried on. The delivery is in the dashboard too, so you can
read the payload that broke it and
replay it after the fix.
No tunnel, no expiring URL, nothing registered with the platform
twice.
Get it
Pick whichever fits your machine; they all install the same thing.
npm install -g commercehook # needs Node 20+ brew install commercehook/tap/commercehook # no Node needed npx commercehook --help # just trying it out
It is a 7 kB npm package with zero dependencies (the Homebrew
version is a standalone binary), and
commercehook upgrade
always knows how to update whichever route you took.
Then sign in, then listen
No token to paste. The browser opens on the same consent screen any
connected app gets, and the CLI shows up under Connected apps in
settings, revocable there like anything else. Headless machines use
an API key via CH_API_KEY.
$ commercehook login Opening your browser to sign in⦠Signed in as you@example.com (pro). $ commercehook listen my-store --forward-to http://localhost:3000/webhooks
Two commands from install to deliveries on your machine. If you have
no endpoint yet, commercehook
endpoints create my-store prints the URL to register with your
platform.
The rest of the toolbox
- commercehook listen <endpoint> --forward-to <url>
- Stream deliveries into the handler on your machine
- commercehook events <endpoint> --tail
- One line per delivery, live, without forwarding
- commercehook event <id>
- The inspector in your terminal; --raw for the exact body
- commercehook replay <id> --to <url>
- Re-send a delivery at any handler
- commercehook endpoints
- List, create, rename, delete
- commercehook whoami
- Which account this terminal acts as
Every command takes --json
and passes the API response through untouched, so it pipes into jq
the way you would hope. Zero dependencies, a few kilobytes.