Docs menu

Tools

Environment variables

Every variable channelstack reads, and every variable it prints for the app. Each is marked by who reads it: the server (channelstack start, or a server an SDK starts), a client (the CLI's attach commands, the SDKs, the Vitest plugin, pytest), or the app (your bot, integration or agent, from what channelstack env prints).

CHANNELSTACK_SLACK_WEBHOOK_URL=http://localhost:3000/slack/events
CHANNELSTACK_SEED=42

An empty variable counts as not set everywhere.

Server#

VariableDefaultMeaning
CHANNELSTACK_HOME~/.channelstackThe state directory: server.json, secrets.json (fake tokens and signing secrets, 0600), ca/ (proxy mode's CA), browser/ (saved browser sessions), the live ledgers. Clients read it too
CHANNELSTACK_SEEDrandom per startMakes generated ids reproducible. Up to 9 digits is used as the seed; any other string is hashed into one
CHANNELSTACK_LOG_LEVELinfodebug, info, warn, error or silent. Any other value means info. --log-level wins
CHANNELSTACK_SERVER_FILE<home>/server.jsonWhere start writes the control API's URL and token (0600). --server-file wins. The attach CLI reads it too
CHANNELSTACK_<CHANNEL>_WEBHOOK_URLnoneWhere the server delivers that channel's events to the app. Read once, when the server starts
CHANNELSTACK_<CHANNEL>_APP_<NAME>_WEBHOOK_URLnoneWhere the server delivers that channel's events to another app, the one a test makes with createApp({ name }). Read once, when the server starts

<CHANNEL> is SLACK, GITHUB, LINEAR, NOTION, RESEND, GOOGLE or DISCORD: CHANNELSTACK_SLACK_WEBHOOK_URL, CHANNELSTACK_GITHUB_WEBHOOK_URL, CHANNELSTACK_LINEAR_WEBHOOK_URL, CHANNELSTACK_NOTION_WEBHOOK_URL, CHANNELSTACK_RESEND_WEBHOOK_URL, CHANNELSTACK_GOOGLE_WEBHOOK_URL, CHANNELSTACK_DISCORD_WEBHOOK_URL. The value is the app's own endpoint for that platform, e.g. http://localhost:3000/slack/events. For Google it is the push endpoint: Pub/Sub's pushes go there, and their tokens are for it as their audience. For Discord it is the app's interactions endpoint URL, e.g. http://localhost:3000/interactions: slash commands and button presses go there, signed with Ed25519.

<NAME> is the app's name in upper case with - as _: coder is CODER, code-reviewer is CODE_REVIEWER, as in CHANNELSTACK_SLACK_APP_CODER_WEBHOOK_URL. An app without one receives nothing, unless it opens its own Socket Mode connection. See Several apps.

An app on Slack's Socket Mode connects out and needs no webhook URL. Without one and without a socket, a Slack interaction is refused with dispatch_failed. A Discord bot hears everything else over the Gateway connection it opens itself; without CHANNELSTACK_DISCORD_WEBHOOK_URL, its interactions arrive there too, as INTERACTION_CREATE. See Connecting your app.

Client#

VariableRead byMeaning
CHANNELSTACK_URLCLI, SDKs, Vitest plugin, pytestThe server to attach to, instead of the one in server.json. A trailing slash doesn't matter, to the CLI or the SDKs
CHANNELSTACK_TOKENCLI, SDKs, Vitest plugin, pytestThe control API token for CHANNELSTACK_URL. The CLI needs it whenever a URL is given; the SDKs fall back to server.json's token when its URL is the same
CHANNELSTACK_HOMECLI, SDKs, Vitest plugin, pytestWhere server.json is: <home>/server.json
CHANNELSTACK_SERVER_FILECLIWhere the attach commands read the URL and token. The SDKs always read <home>/server.json
CHANNELSTACK_SERVER_BINSDKs, Vitest plugin, pytestThe server binary to start in auto or start mode. TypeScript: default the installed @channelstack/server-<platform>-<arch> package. Python and Rust: default channelstack on the PATH
CHANNELSTACK_VITEST_OPTIONSVitest pluginSet by the plugin itself: its options as JSON, for its global setup. Don't set it

People's live tokens#

The SDKs read a person's token from the environment when a test leaves token out of createUser. With the variable unset, the person is fake. So one test runs fake on every PR, and live where the variables are set.

VariableFor
CHANNELSTACK_SLACK_USER_<NAME>_TOKENslack.createUser({ name }): a user token (xoxp-…) from a Slack app for the sandbox's people, not the app's own app
CHANNELSTACK_GITHUB_USER_<LOGIN>_TOKENgithub.createUser({ login }): a machine user's fine-grained PAT
CHANNELSTACK_LINEAR_USER_<NAME>_TOKENlinear.createUser({ name }): a personal API key
CHANNELSTACK_NOTION_USER_<NAME>_TOKENnotion.createUser({ name }): a personal access token
CHANNELSTACK_RESEND_USER_<NAME>_TOKENresend.createUser({ name }): an API key of the person's own Resend team, with a verified domain their address is on
CHANNELSTACK_GOOGLE_USER_<NAME>_TOKENgoogle.createUser({ name }): a refresh token for the person's own Gmail account, from the agent's OAuth client
CHANNELSTACK_DISCORD_USER_<NAME>_TOKENdiscord.createUser({ name }): the bot token of a second application in the sandbox guild, which acts as the person through Discord's API. Discord has no API that acts as a person; what the bot writes carries author.bot

<NAME> is the name in upper case with every run of other characters as _: Ana is ANA, ana-smith is ANA_SMITH, the login ana-channelstack is ANA_CHANNELSTACK.

Live mode#

Read by the server. A channel runs live when every one of its credentials is set; with none set it runs fake. With some set and not all, its operations are refused with live_misconfigured, naming what is missing. See Live mode.

ChannelCredentialsAllowlistAlso
SlackCHANNELSTACK_SLACK_APP_ID, CHANNELSTACK_SLACK_BOT_TOKEN (xoxb-…)CHANNELSTACK_LIVE_SLACK_TEAMS: workspace ids (T…)
GitHubCHANNELSTACK_GITHUB_APP_ID, CHANNELSTACK_GITHUB_PRIVATE_KEY (the App's PEM)CHANNELSTACK_LIVE_GITHUB_ORGS: account logins the App is installed on
LinearCHANNELSTACK_LINEAR_APP_TOKEN (the app's OAuth token)CHANNELSTACK_LIVE_LINEAR_WORKSPACES: organization ids
NotionCHANNELSTACK_NOTION_TOKEN (the integration's token)CHANNELSTACK_LIVE_NOTION_WORKSPACES: workspace idsCHANNELSTACK_NOTION_PAGE, CHANNELSTACK_NOTION_UNSEEN_PAGE
ResendCHANNELSTACK_RESEND_API_KEY (the agent's team's key, re_…)CHANNELSTACK_LIVE_RESEND_DOMAINS: the domains mail may go to. Every recipient is checked before anything is sentCHANNELSTACK_RESEND_ADDRESS
GoogleCHANNELSTACK_GOOGLE_CLIENT_ID, CHANNELSTACK_GOOGLE_CLIENT_SECRET (the agent's OAuth client, GOCSPX-…), CHANNELSTACK_GOOGLE_REFRESH_TOKEN (its mailbox's refresh token, 1//0…)CHANNELSTACK_LIVE_GOOGLE_ADDRESSES: the addresses mail may go to and come from, the agent's and the people's. Every recipient is checked before anything is sent
DiscordCHANNELSTACK_DISCORD_BOT_TOKEN (the agent's real bot token)CHANNELSTACK_LIVE_DISCORD_GUILDS: guild ids. Live Discord runs in the first one the bot is in

Allowlists are comma-separated. Live mode acts only where its allowlist names the workspace (for Resend the domain, for Google the address, for Discord the guild); anywhere else is refused with live_not_allowlisted, and an empty allowlist means live mode acts nowhere.

VariableDefaultMeaning
CHANNELSTACK_REALITYunsetfake: every channel runs fake, credentials or not. live: nothing may fall back to fake; a person without a token is refused with live_misconfigured. Any other value is an error
CHANNELSTACK_RUN_IDrandom (10 characters)The run's id, in the tag every live object carries (channelstack-run-<id>) and for channelstack sweep --run. 1 to 24 letters and digits, lowercased; 7 or more digits in a row are written in base 36 (Linear refuses names that look like phone numbers). CI sets it to the job's
CHANNELSTACK_NOTION_PAGEthe only top-level page the integration seesThe page live Notion tests create their pages under. Needed when the integration sees more than one
CHANNELSTACK_NOTION_UNSEEN_PAGEnoneA page the people can write in and the integration isn't connected to, for tests that create a page the integration can't see
CHANNELSTACK_RESEND_ADDRESSmy-agent@ the team's first verified domainWhere people email the agent live: an address on its team's receiving domain

channelstack's own nightly run also checks the fake OpenAI against the real API with CHANNELSTACK_OPENAI_LIVE_KEY (an OpenAI API key, maintainers only) and CHANNELSTACK_OPENAI_LIVE_MODEL (the cheap model it asks, default gpt-5-nano). Without the key that lane runs the fake side only. The server doesn't read them, and the fake model has no live mode: an agent pointed at it gets the fake in every run.

It also reads CHANNELSTACK_DISCORD_PUBLIC_KEY (the real application's public key, which its reference agent checks interactions with) and CHANNELSTACK_DISCORD_RELAY_URL (the smee.io channel the application's interactions endpoint points at, relayed to the reference agent). The server doesn't read them: your own agent has its own configuration live.

Live credentials stay in the server's memory. They are never logged, never returned by the control API, and channelstack env prints nothing for a live channel.

What channelstack env prints#

Read by the app. channelstack env (and the channelstack.env() fixture) prints the fake channels' settings as KEY=value lines. The values come from the running server: the URLs follow how it was started (portless names, or --no-portless paths), and the secrets are this install's, from <home>/secrets.json.

VariableChannelValue
SLACK_API_URLSlackThe Web API base, e.g. https://slack.localhost/api/
SLACK_BOT_TOKENSlackxoxb-…
SLACK_APP_TOKENSlackxapp-…, for Socket Mode
SLACK_SIGNING_SECRETSlack
GITHUB_API_URLGitHubE.g. https://github.localhost
GITHUB_APP_IDGitHub
GITHUB_APP_SLUGGitHub
GITHUB_INSTALLATION_IDGitHub
GITHUB_BOT_USER_IDGitHub
GITHUB_PRIVATE_KEYGitHubThe App's PEM on one line, with \n for its line breaks
GITHUB_WEBHOOK_SECRETGitHub
LINEAR_API_URLLinearThe GraphQL endpoint, e.g. https://linear.localhost/graphql
LINEAR_ACCESS_TOKENLinearThe app's OAuth token
LINEAR_WEBHOOK_SECRETLinear
LINEAR_CLIENT_IDLinear
LINEAR_CLIENT_SECRETLinear
NOTION_BASE_URLNotionE.g. https://notion.localhost
NOTION_TOKENNotionThe integration's token
NOTION_VERIFICATION_TOKENNotionWhat webhook deliveries are signed with
RESEND_BASE_URLResendE.g. https://resend.localhost. The resend SDK reads it itself
RESEND_API_KEYResendThe agent's team's key (re_…)
RESEND_WEBHOOK_SECRETResendWhat webhook deliveries are signed with (whsec_…)
RESEND_FROMResendThe address the agent sends from, with its name: my-agent <my-agent@acme.example>
GOOGLE_API_URLGoogleThe root to give googleapis as rootUrl, per API: e.g. https://google.localhost/
GOOGLE_TOKEN_URLGoogleGoogle's token endpoint, for OAuth2Client's endpoints.oauth2TokenUrl
GOOGLE_CERTS_URLGoogleThe certificates push tokens are signed against, for endpoints.oauth2FederatedSignonPemCertsUrl
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRETGoogleThe agent's OAuth client (…apps.googleusercontent.com, GOCSPX-…)
GOOGLE_REFRESH_TOKENGoogleThe agent's mailbox's refresh token (1//0…): the token endpoint takes the refresh_token grant only
GMAIL_ADDRESSGoogleThe agent's mailbox: my-agent@acme.example
GOOGLE_PUBSUB_TOPICGoogleThe topic to give users.watch: the only one the fake publishes to
GOOGLE_PUSH_SERVICE_ACCOUNTGoogleWho pushes: the email claim of every push token
GOOGLE_PUSH_AUDIENCEGoogleThe aud of every push token: the push endpoint, CHANNELSTACK_GOOGLE_WEBHOOK_URL (for another app, its own variable). Printed when that is set
DISCORD_API_URLDiscordThe REST base to give discord.js as rest.api, e.g. https://discord.localhost/api. discord.js adds /v10 and finds the Gateway from GET /gateway/bot
DISCORD_TOKENDiscordThe bot's token, for client.login
DISCORD_APPLICATION_IDDiscordThe application's id, the bot's too: for registering commands
DISCORD_PUBLIC_KEYDiscordThe application's Ed25519 public key (hex), which interactions over HTTP are checked against with verifyKey
DISCORD_GUILD_IDDiscordThe guild the bot is in: for registering guild commands
OPENAI_BASE_URLThe modelThe fake OpenAI's base URL with its /v1, e.g. https://openai.localhost/v1. The official openai SDKs and the AI SDK's OpenAI provider read it themselves; give it to anything else that takes an OpenAI base URL. See OpenAI
OPENAI_API_KEYThe modelThe fake's key (sk-proj-…), random per install. The fake refuses calls without it, as OpenAI does
ECHO_API_URL, ECHO_APP_TOKEN, ECHO_SIGNING_SECRETEchochannelstack's own test platform. Ignore them

The names are the ones the platforms' SDKs and examples use; map them to your app's own if they differ. channelstack secrets rotate changes every secret; run channelstack env again after a restart.

channelstack env --app and --channel#

channelstack env --app coder (and channelstack.env({ app: "coder" })) prints another app's lines under the same keys: SLACK_BOT_TOKEN is coder's bot token, GITHUB_APP_ID its App's id, RESEND_FROM coder <coder@coder.acme.example>, GMAIL_ADDRESS coder@acme.example, and so on. A second agent process starts from an .env of the same shape as the first. Asking makes the app, with the channel's default settings, if no test has made it yet, so the agent can start before the tests; without --channel, on every channel. --app my-agent is the same as no --app. A name that isn't an app's (1 to 32 lower-case letters, digits and hyphens, starting with a letter) is refused with invalid_argument.

--channel slack prints that channel's lines only, which is what a second agent on one channel needs: channelstack env --app coder --channel slack. A channel that doesn't exist is not_found.

channelstack env --proxy#

For an app that hard-codes the platforms' hosts. The server must run with --proxy. It prints the same lines without the API URLs (the app keeps slack.com and the others, and OPENAI_BASE_URL is left out: the proxy sends api.openai.com to the fake, and OPENAI_API_KEY stays), plus:

VariableValue
HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxyhttp://127.0.0.1:<proxy port> (default port 7464)
NO_PROXY, no_proxylocalhost,127.0.0.1,::1,.localhost
NODE_USE_ENV_PROXY1: Node 24 routes its own http, https and fetch through the proxy only with it
NODE_OPTIONS--import="<home>/proxy/node-env-proxy.mjs": keeps Node's proxy-aware fetch in an app that loads undici 7 or later
NODE_EXTRA_CA_CERTS<home>/ca/ca.pem: channelstack's CA alone
SSL_CERT_FILE<home>/ca/bundle.pem: the public roots plus the CA, for runtimes that replace their bundle
REQUESTS_CA_BUNDLE<home>/ca/bundle.pem, for Python's requests

The CA is trusted only by the app that gets these variables. See Proxy mode.

Suggest changes to this page