The devotel CLI model
Thedevotel CLI exists for one loop the SDKs and curl cannot close: building a webhook handler against live events without deploying anything. An SDK types request/response calls; curl runs them; neither can push a signed message.delivered event into localhost:3000 while you edit the handler. This page is the full model behind that loop: what installs, the complete command surface, where the credential lives and how profiles resolve, how a sandbox profile keeps smoke tests off live billing, what a script or CI pipeline may rely on, and where the CLI stops and the dashboard begins. For the flag-by-flag walkthrough, see the devotel CLI guide.
Install
- npm is the single distribution channel on every platform — macOS, Linux, and Windows all install the same
@devotel-orbit/clipackage, which puts onedevotelbinary on yourPATH. There is no Homebrew tap and no curl installer today; what your laptop installs is exactly what a CI runner installs. - The package requires Node 22 or newer (
enginesin the package manifest). - If the binary does not resolve after install, run
npm config get prefixand put<prefix>/binon yourPATH. Undernvm, global packages are per-Node-version, so reinstall the CLI after switching versions.
What ships today
The full surface, exactly asdevotel help prints it at 0.1.0:
Why a dedicated CLI exists
curl and the SDKs cover the request/response plane well. The gap is the inbound plane: webhooks arrive server-to-server, so a local handler under development is unreachable. The standard workaround — a public tunnel such as ngrok — puts your work-in-progress code on a public URL and adds a credential-managed dependency. A first-party CLI closes that loop client-side: it reads the event history over the API (the same endpoint the dashboard reads) and POSTs each event to yourlocalhost, signed with the exact X-Devotel-Signature scheme the production dispatcher emits. Your handler code runs unchanged — the same verifier call, the same envelope shape — so “works locally” and “works in production” are the same claim.
The auth model
Every command resolves its identity in two steps: which profile, then which credential.- Profile name — the
--profileflag wins, then$DEVOTEL_PROFILE, thendefault. - Credential — the profile’s entry in the workspace config file. At command time nothing else is consulted: no environment token is silently picked up, so the profile you named is exactly the credential that signs the request.
auth login takes --token <t>, or $DEVOTEL_TOKEN when the flag is absent — the CI form, because a flag would put the key in the argv list. --url at login time pins the API base URL stored next to the token (the default is shown in the help text above), which is how a profile can point at a different deployment.
The config file is ~/.devotel/config.json: the directory is created 0700 and the file written 0600 (owner-read-only), because it holds a bearer credential. Move the whole directory with DEVOTEL_CONFIG_HOME. There is deliberately no OS keychain — a plain, permission-scoped JSON file behaves identically on a laptop and on a headless runner, and there is no keyring service to be unavailable in CI. A corrupt file does not wedge the CLI either: it starts from an empty config, so if whoami suddenly says you are not logged in after hand-editing the file, the JSON no longer parses.
The token’s shape decides the auth scheme the client sends: dv_… keys go as X-API-Key; anything else as Authorization: Bearer. That second arm is intentional — a session token copied from a dashboard session works, but session tokens expire on session cadence, so anything you want to keep should be an API key minted in Dashboard → Developers → API keys. That is also the difference from dashboard auth in one sentence: the dashboard authenticates a browser session (cookies, re-auth challenges), while the CLI authenticates a stored key it never prints in full — auth whoami shows a short prefix and suffix only, which makes its output safe to paste into a chat or a ticket.
Profiles: one per tenant or environment
A profile is just a named (token, base URL) pair in the config file, so the working shape is one profile per environment or per tenant you operate:auth login also records the profile it wrote as the config’s current entry, but command-time resolution still runs flag → env → default, so an explicit --profile always beats whatever login touched last, and two shells on one machine never clobber each other. auth logout --profile staging removes one entry without touching the rest.
Sandbox from the terminal
Sandbox is not a CLI flag — it is a property of the credential. Adv_test_sk_… key resolves every request into the sandbox context: sends short-circuit before carrier dispatch, so nothing done under that profile touches live billing or a real network; delivery receipts are simulated; every stored row and emitted event carries the test marker. Give the test key its own profile and the sandbox boundary becomes a profile switch:
sandbox numbers lists the pool you may send from; the magic numbers still key the simulated receipt (delivered vs. undelivered) on the recipient’s trailing digit, exactly as over the API — see the sandbox model for the boundary itself. The last line is the pairing that matters: listen under a sandbox profile forwards sandbox events with the same X-Devotel-Signature scheme as live ones, so your handler’s verify-then-process path is exercised end to end before a single live message exists.
The webhook-forwarding loop
devotel listen is the harness the CLI exists for. A session runs four steps, and all of them are client-side polling plus local POSTs — no new server surface, no public URL:
- Open the session. Mint an ephemeral signing secret (
whsec_…) unless you pinned one with--secretorDEVOTEL_WEBHOOK_SECRET. The CLI prints it once, on startup. - Subscribe. Poll the first-party
GET /eventshistory endpoint — the same Redis replay buffer the dashboard’s event stream reads — tailing forward from a monotonic stream-id cursor. A--typesallowlist narrows the subscription (mirroring the server’s filter semantics: no filter delivers everything). - Forward. Re-shape each event into the canonical webhook envelope
{ id, type, created_at, data }and POST it to your local URL withX-Devotel-Signature: t=<ts>,v1=<hmac>— byte-for-byte the header the production dispatcher emits. Your handler verifies it with the same SDK verifier call it uses in production. - Terminate on exit. Ctrl-C ends the poll loop; the ephemeral secret and the cursor die with the process. Nothing was registered server-side, so nothing needs cleanup.
--replaybackfills the buffered events first, then tails.
One session, end to end
Start the forwarder while your handler runs on the machine:500. The CLI prints the non-2xx line and keeps the session alive; the platform’s own retry schedule (attempt one of ten, on the delivery-semantics backoff) re-delivers the event, the forwarder sees it again, and this attempt resolves locally once you fix the handler. That is the loop: the retried webhook resolves on your machine, before anything deploys.
The scripting contract
A script or CI pipeline may rely on three things:- Exit codes.
0is success.2is a usage error — unknown command, missing required flag — and means nothing reached the API.1is a runtime failure, including API errors, printed asAPI error <status> (<code>): <message> [request_id=…]; therequest_idin that line is what support needs when you paste it. - Machine-readable output.
--jsonworks on every command that prints data (send sms,numbers list,sandbox numbers,logs tail,migrate status,listen): one JSON value for list and status commands, one JSON object per line for the two streams, sojqpipelines stay trivial. - No hidden state.
listenregisters nothing server-side; Ctrl-C is the entire cleanup, and a killed CI job leaves nothing to revoke.
send sms invocation is a fresh request, and there is no client-side idempotency-key flag. For exactly-once scripted sends, use the platform’s idempotency contract at the API or SDK layer (see idempotency and safe retries) — and if a CLI send times out, do not retry blind: check devotel logs tail or the dashboard for the message id first.
A CI-shaped session, credentials-in-env form:
Where the CLI stops
The CLI is a developer loop, not a console. These surfaces are dashboard-only today, so you do not hunt for them in a terminal:- Campaign launches, journey builds, and A/B tests — the dashboard (and the API).
- Marketplace installs and listing moderation.
- Compliance attestation and evidence-binder runs.
- Buying and porting numbers — the CLI lists inventory (
numbers list); procurement flows live in the dashboard. - Channel onboarding (WABA connects, sender-ID registrations) and inbox operations.
- OS keychain storage and non-npm installers — absent by design and by today, respectively, as above.
Troubleshooting
CLI planes vs. the dashboard event pages
Uselisten/tail when you are developing — you want events pushed into local code, or a raw stream piped into jq. Use the dashboard’s event log and webhook debug pages when you are operating — historical search across the team, dead-letter inspection and replay, endpoint health. The CLI is the inner loop; the dashboard is the shared record. Neither replaces the other.
Map to the guide
Install, login, first send, and the flag-by-flag walkthrough live in the devotel CLI guide; migration walkthroughs live in Migrate from Twilio and Migrate from Telnyx. This page is the model behind them: read the guide to run the commands, read this page when you need to explain to a teammate why the credential file sits at~/.devotel instead of a keychain, why a sandbox profile never touches live billing, why the forwarded signature matches production, or why the listen loop was worth a first-party binary.