Skip to content

Create the Slack app ​

Each team runs TWD Design with its own Slack app: the tokens never leave your infrastructure. The repo ships a manifest, so creating the app is a paste and a few clicks. About 5 minutes.

1. Create it from the manifest ​

The quickest way is the setup command, from a clone of the repo. It asks for your app's name, handle and color, gives you a link that creates the app with them, then checks the tokens against Slack and writes them to .env:

bash
npm install
npm run setup

Or create it with the TWD Design defaults in one click, and rename it later in the app settings: Create the Slack app.

Or by hand:

  1. Go to api.slack.com/apps → Create New App → From a manifest.
  2. Pick the workspace.
  3. Paste the contents of slack-manifest.yaml (YAML tab) → Next → Create.

Before you paste it, make it yours. The manifest marks every line as CHANGE or KEEP:

FieldChange it?What it is
display_information.nameYesThe app name people see in Slack.
display_information.descriptionYesShort description on the app card.
display_information.background_colorYesApp card color.
features.bot_user.display_nameYesThe handle people mention, e.g. @design-bot.
oauth_config.scopesNoWhat the bot can do. See Scopes.
settings.event_subscriptions.bot_eventsNoWhat the bot listens to.
settings.socket_mode_enabledOnly for HTTP modeSee Socket Mode or HTTP.

Your brand on the bot

The icon isn't in the manifest: upload it in Basic Information → Display Information after creating the app. Use brand/slack-icon.png (TWD's icon, 512×512) or your own. Name, handle, color and icon are all the branding the bot itself has. The prototypes' look comes from your repo's DESIGN.md, see Your design guide.

2. Get the tokens ​

npm run setup asks for these and checks them; this is where each one lives.

TokenWhereVariable
App-Level TokenBasic Information → App-Level Tokens → Generate Token and Scopes, scope connections:writeSLACK_APP_TOKEN (xapp-…)
Bot tokenInstall App → Install to Workspace, then copy the Bot User OAuth TokenSLACK_BOT_TOKEN (xoxb-…)
Signing secretBasic Information → App CredentialsSLACK_SIGNING_SECRET (HTTP mode only)

If your workspace requires admin approval, Install to Workspace becomes Request to Install: the bot token appears once an admin approves it.

3. Invite the bot ​

The bot only sees channels it is a member of. In each channel where you want to use it:

/invite @twd-design

Scopes ​

Every scope the manifest asks for, and why. Hand this table to whoever approves Slack apps in your company.

ScopeWhy the bot needs it
app_mentions:readReceive @twd-design mentions, which start or continue a thread.
chat:writeReply in the thread.
files:writeAttach the prototype .html to the thread.
files:readDownload the latest prototype from the thread to iterate on it. The thread is the bot's only storage.
channels:historyRead the thread's messages in public channels: the conversation is the context for each new version. Also delivers replies in a thread the bot is in, so people don't have to mention it every time.
groups:historyThe same, in private channels the bot was invited to.
reactions:writeAdd ⏳ to your message while it works, in workspaces where Slack's own "working… Stop" indicator isn't available.

The bot doesn't read channels it isn't in, doesn't work in DMs, and never stores messages: it reads the thread when someone talks to it and forgets it after replying.

The manifest also turns on, with no extra scopes:

SettingWhat for
InteractivityThe buttons under each version (approve, go back, pick the repo), the examples in the welcome, and the repo picker.
Home tab (app_home_opened)How to use the bot, and the prototypes waiting to be built.
agent_session_stoppedSlack's own Stop button while the bot works.

Updating an app you created before

Copy the current slack-manifest.yaml, paste it in your app under App Manifest (keep your name, handle and color), save, and reinstall when Slack asks. Without it the bot still answers, but buttons do nothing and there is no Home tab or Stop button.

Changed the scopes?

After any change to scopes or events, Slack asks you to reinstall the app (Install App → Reinstall to Workspace). Until then the old permissions apply.

Socket Mode or HTTP ​

Socket Mode (default)HTTP
How events arriveThe bot opens an outbound WebSocket to SlackSlack sends POST requests to your URL
Public URLNot neededRequired (HTTPS)
Behind a firewallWorks as isNeeds an ingress
VariablesSLACK_APP_TOKENSLACK_SIGNING_SECRET, PORT
Slack MarketplaceNot allowedAllowed (irrelevant when self-hosting)

Use Socket Mode unless your company forbids outbound WebSockets. To switch to HTTP:

  1. In the manifest, set socket_mode_enabled: false and uncomment both request_url lines (events and interactivity) with your URL (https://<your-host>/slack/events).
  2. Leave SLACK_APP_TOKEN empty and set SLACK_SIGNING_SECRET.
  3. Expose PORT (3000) through your ingress. Slack verifies the URL when you save the manifest, so the bot must be running.

Next ​

MIT License · Part of TWD