The CLI
Sign in, set up projects and sources, follow events, and run a command for each one.
The briefkasten command manages any instance, hosted or your own, and receives events. Every command takes --json for output a script or an agent can read.
npm install -g @briefkasten/cliSign in
briefkasten login you@example.com # a code by mail
briefkasten login --device # approve a code in a browser elsewhere
briefkasten login --token bk_pat_… # a token, for CI
briefkasten whoami
briefkasten logoutlogin asks for the emailed code; pass --code (and --mfa with two-factor on) to skip the prompts. The first sign-in creates your account and asks whether you accept the terms of use and the privacy policy; scripts and agents pass --accept-terms. With --device the CLI prints a code and a URL; approve it on any device where you are signed in.
Targets
The CLI keeps one credential per target: the hosted service, a self-hosted gateway, or a local config file. Switch with use, like contexts in kubectl:
briefkasten use https://hooks.example.com # a self-hosted gateway
briefkasten use local # ./briefkasten.config.jsonTokens
A subscriber token lets a server receive events; a management token lets a script change the config. Both are shown once.
briefkasten token create --name my-server --project acme-shop
briefkasten token create --name ci --scope manage
briefkasten token ls
briefkasten token rm my-serverSet BRIEFKASTEN_TOKEN and the CLI uses it instead of a sign-in.
Projects and sources
briefkasten project add acme-shop
briefkasten project ls # default first: every account has it
briefkasten project rm acme-shop
briefkasten source add github --project acme-shop
briefkasten source add linear --project acme-shop --secret lin_wh_…
briefkasten source ls --project acme-shop
briefkasten source rotate github --project acme-shop # a new secret, shown once
briefkasten source set github --project acme-shop --option repos=acme/shop
briefkasten source rm github --project acme-shop--project is optional wherever a command acts on one project: without it, the command acts on the default project (briefkasten source add github adds default/github). default cannot be deleted.
Linear, Sentry and PostHog make the signing secret themselves: pass it with --secret. For the others briefkasten generates one.
Test events
briefkasten source samples github # the samples an adapter has
briefkasten source test github --project acme-shop --event pushsource test asks the gateway to run a sample through the source itself: no secret needed, and routes, subscribers and streams see it as a test event. It is what the dashboard and the MCP tools use.
Sending webhooks
send posts a real delivery to the source's hook URL, signed with its secret the way the provider signs, so it goes through verification like the provider's own. Use it to test the whole way in, or to simulate traffic:
briefkasten send github --event pull_request.opened --set pull_request.title="Fix login"
briefkasten send github --event push --json "$(cat push.json)" # your own payload
briefkasten send github --random --every 5s # random events until Ctrl-C
briefkasten send github --random --every 1s --count 100 # a burst of a hundred--random picks random events of the source's adapter with random repositories (the source's repos, if it has any), numbers, titles and authors. The cloud never shows a secret again after it was created, so pass it with --secret (a self-hosted gateway's local config has it already).
Routes
Routes decide which subscriber gets which events of a project. Without routes, every subscriber gets every event it may see.
briefkasten route ls --project acme-shop
briefkasten route set --project acme-shop \
--params '{"routes":[{"match":{"event":"pull_request.*"},"to":["review-bot"]}]}'Events
briefkasten events --project acme-shop # the latest events
briefkasten events --follow --source github # new ones as they arrive
briefkasten event show evt_01JE7Q… # headers, body, deliveries
briefkasten event redeliver evt_01JE7Q… --subscriber my-server
briefkasten usageListeners
listen streams events to your terminal, or runs a command once per event:
briefkasten listen --filter '*:github:**' \
--exec 'echo "$BRIEFKASTEN_TYPE on $BRIEFKASTEN_TARGET"'| Flag | What it does |
|---|---|
--filter | Address globs, comma-separated: project:adapter:source:target:event |
--project | Only this project's events |
--exec | A shell command to run for each event |
--format | json (default) or text |
--once | Stop after the first event |
--server | The gateway's URL, instead of the target's |
The command gets the event in its environment:
| Variable | Value |
|---|---|
BRIEFKASTEN_EVENT | The whole event, as JSON |
BRIEFKASTEN_EVENT_ID | Its id |
BRIEFKASTEN_TYPE | The event name, e.g. pull_request.opened |
BRIEFKASTEN_PROJECT, BRIEFKASTEN_ADAPTER, BRIEFKASTEN_SOURCE | Where it came from |
BRIEFKASTEN_TARGET | The repository, team or service it is about |
BRIEFKASTEN_TENANT, BRIEFKASTEN_AT | Whose it is, and when it arrived |
A listener resumes where it stopped: after a restart it asks for everything since the last event it handled.
For agents and scripts
Every command takes --json and reads input with --params, so nothing waits on a prompt. briefkasten mcp serves the same operations as MCP tools over stdio: see MCP.