|
| 1 | +--- |
| 2 | +title: Slack Bot |
| 3 | +sidebar_custom_props: |
| 4 | + icon: slack |
| 5 | +--- |
| 6 | + |
| 7 | +import Tabs from '@theme/Tabs' |
| 8 | +import TabItem from '@theme/TabItem' |
| 9 | + |
| 10 | +Mission Control Assistant is a Slack bot that responds to direct messages and @mentions. The bot uses Slack Socket Mode, which opens a WebSocket connection so you do not expose a public webhook endpoint. |
| 11 | + |
| 12 | +## Slack app creation and installation |
| 13 | + |
| 14 | +### Before you start |
| 15 | + |
| 16 | +- A Slack workspace where you can create apps |
| 17 | +- An Anthropic, OpenAI, or Google Generative AI API key for the LLM provider |
| 18 | + |
| 19 | + |
| 20 | +### Create the Slack app |
| 21 | + |
| 22 | +1. Go to [api.slack.com/apps](https://api.slack.com/apps) and select **Create New App**. |
| 23 | +2. Choose **From scratch**, name the app, and select the workspace. |
| 24 | +3. Select **Create App**. |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +### Enable Socket Mode |
| 29 | + |
| 30 | +Open **Settings** → **Socket Mode** and turn on **Enable Socket Mode**. |
| 31 | + |
| 32 | +You'll be prompted to generate an app-level token with access to the `connections:write` scope. |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +Store the token value as `SLACK_APP_TOKEN` env var. |
| 37 | + |
| 38 | +### Enable App Home messages |
| 39 | + |
| 40 | +Open **Features** → **App Home** and enable these settings: |
| 41 | + |
| 42 | +- **Messages Tab** |
| 43 | +- **Allow users to send Slash commands and messages from the messages tab** |
| 44 | + |
| 45 | +These settings let users send direct messages to the bot from the App Home Messages tab. Without them, Slack disables messages to the app. |
| 46 | + |
| 47 | +### Add bot token scopes |
| 48 | + |
| 49 | +Open **Features** → **OAuth & Permissions** and add these bot token scopes: |
| 50 | + |
| 51 | +| Scope | Description | |
| 52 | +| --- | --- | |
| 53 | +| `app_mentions:read` | View messages that directly mention @Mission Control AI Assistant in conversations that the app is in. | |
| 54 | +| `chat:write` | Send messages as @Mission Control AI Assistant. | |
| 55 | +| `groups:history` | View messages and other content in private channels that Mission Control AI Assistant has been added to. | |
| 56 | +| `im:history` | View messages and other content in direct messages that Mission Control AI Assistant has been added to. | |
| 57 | +| `im:read` | View basic information about direct messages that Mission Control AI Assistant has been added to. | |
| 58 | +| `im:write` | Start direct messages with people. | |
| 59 | + |
| 60 | +### Add bot events |
| 61 | + |
| 62 | +Open **Features** → **Event Subscriptions**, enable events, and subscribe the bot to these events: |
| 63 | + |
| 64 | +| Event name | Description | Required scope | |
| 65 | +| --- | --- | --- | |
| 66 | +| `app_mention` | Subscribe to only the message events that mention your app or bot. | `app_mentions:read` | |
| 67 | +| `message.im` | A message was posted in a direct message channel. | `im:history` | |
| 68 | + |
| 69 | +### Install the app |
| 70 | + |
| 71 | +Finally, you can go back to **Features** → **OAuth & Permissions** and select **Install to Workspace**. |
| 72 | + |
| 73 | +After installation, you'll see the Bot User OAuth Token (starts with `xoxb-`) on that same page. |
| 74 | +Store the token value as `SLACK_BOT_TOKEN` env var. |
| 75 | + |
| 76 | +## Mission Control MCP URL and token |
| 77 | + |
| 78 | +You need the MCP URL and bearer token to connect the bot to Mission Control tools. |
| 79 | + |
| 80 | +### Get the MCP URL and token |
| 81 | + |
| 82 | +Use the Setup MCP flow to get both values. |
| 83 | + |
| 84 | +1. In Mission Control, open the user menu and select **Setup MCP**. |
| 85 | +2. Select **Create new token**. |
| 86 | +3. In the token details dialog, select **Slack Bot** and copy `MCP_URL` and `MCP_BEARER_TOKEN`. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +## Deployment |
| 91 | + |
| 92 | +#### Create the Kubernetes Secrets (Helm and Flux) |
| 93 | + |
| 94 | +Create three Secrets for Slack, LLM, and MCP credentials before you deploy with Helm or Flux. |
| 95 | + |
| 96 | +```yaml title="slack-secret.yaml" |
| 97 | +apiVersion: v1 |
| 98 | +kind: Secret |
| 99 | +metadata: |
| 100 | + name: mission-control-slack-bot-slack |
| 101 | +type: Opaque |
| 102 | +stringData: |
| 103 | + SLACK_BOT_TOKEN: xoxb-your-bot-token |
| 104 | + SLACK_APP_TOKEN: xapp-your-app-token |
| 105 | +``` |
| 106 | +
|
| 107 | +```yaml title="llm-secret.yaml" |
| 108 | +apiVersion: v1 |
| 109 | +kind: Secret |
| 110 | +metadata: |
| 111 | + name: mission-control-slack-bot-llm |
| 112 | +type: Opaque |
| 113 | +stringData: |
| 114 | + ANTHROPIC_API_KEY: sk-ant-your-api-key |
| 115 | +``` |
| 116 | +
|
| 117 | +```yaml title="mcp-secret.yaml" |
| 118 | +apiVersion: v1 |
| 119 | +kind: Secret |
| 120 | +metadata: |
| 121 | + name: mission-control-slack-bot-mcp |
| 122 | +type: Opaque |
| 123 | +stringData: |
| 124 | + MCP_URL: https://mission-control.example.com/mcp |
| 125 | + MCP_BEARER_TOKEN: your-mcp-token |
| 126 | +``` |
| 127 | +
|
| 128 | +
|
| 129 | +
|
| 130 | +<Tabs> |
| 131 | +<TabItem label="kubectl Helm release" value="helm" default> |
| 132 | +
|
| 133 | +### Create Secrets |
| 134 | +
|
| 135 | +
|
| 136 | +```bash title="Apply the Slack bot secrets" |
| 137 | +kubectl apply -f slack-secret.yaml |
| 138 | +kubectl apply -f llm-secret.yaml |
| 139 | +kubectl apply -f mcp-secret.yaml |
| 140 | +``` |
| 141 | + |
| 142 | +#### Create the values file |
| 143 | + |
| 144 | +Create a Helm values file to set the secret name and LLM settings for the chart. Update the provider, model, and log level to match your environment. |
| 145 | + |
| 146 | +```yaml title="slack-bot-values.yaml" |
| 147 | +slack: |
| 148 | + secretName: mission-control-slack-bot-slack |
| 149 | +llm: |
| 150 | + provider: anthropic |
| 151 | + secretName: mission-control-slack-bot-llm |
| 152 | + secretKey: ANTHROPIC_API_KEY |
| 153 | + model: claude-haiku-4-5 |
| 154 | +mcp: |
| 155 | + secretName: mission-control-slack-bot-mcp |
| 156 | +``` |
| 157 | +
|
| 158 | +#### Add the Helm repository |
| 159 | +
|
| 160 | +Add the Flanksource Helm repository so Helm can find the Slack bot chart. |
| 161 | +
|
| 162 | +```bash title="Add the Flanksource Helm repository" |
| 163 | +helm repo add flanksource https://flanksource.github.io/charts |
| 164 | +``` |
| 165 | + |
| 166 | +#### Update the Helm repository |
| 167 | + |
| 168 | +Update the Helm repository index so Helm can install the latest chart version. |
| 169 | + |
| 170 | +```bash title="Update the Helm repository index" |
| 171 | +helm repo update flanksource |
| 172 | +``` |
| 173 | + |
| 174 | +This command refreshes the `flanksource` repository metadata on your workstation. |
| 175 | + |
| 176 | +#### Install the chart |
| 177 | + |
| 178 | +Install the chart from the Flanksource Helm repository so Kubernetes runs the deployment with your values. |
| 179 | + |
| 180 | +```bash title="Install the Slack bot chart" |
| 181 | +helm upgrade --install mission-control-slack-bot flanksource/mission-control-ai-assistant -f slack-bot-values.yaml -n mission-control --create-namespace |
| 182 | +``` |
| 183 | + |
| 184 | +The `flanksource/mission-control-ai-assistant` chart name targets the Slack bot chart, `-f` loads your values file, and `--create-namespace` creates the namespace when it does not exist. |
| 185 | + |
| 186 | +</TabItem> |
| 187 | +<TabItem label="Flux Helm release" value="flux"> |
| 188 | + |
| 189 | +#### Create the HelmRepository |
| 190 | + |
| 191 | +Define the Flanksource Helm repository so Flux can fetch the chart. |
| 192 | + |
| 193 | +```yaml title="slack-bot-helm-repository.yaml" |
| 194 | +apiVersion: source.toolkit.fluxcd.io/v1 |
| 195 | +kind: HelmRepository |
| 196 | +metadata: |
| 197 | + name: flanksource |
| 198 | + namespace: mission-control |
| 199 | +spec: |
| 200 | + interval: 10m |
| 201 | + url: https://flanksource.github.io/charts |
| 202 | +``` |
| 203 | +
|
| 204 | +#### Create the HelmRelease |
| 205 | +
|
| 206 | +Create a HelmRelease that points to the Slack bot chart and sets the values for your Slack and LLM credentials. |
| 207 | +
|
| 208 | +```yaml title="slack-bot-helm-release.yaml" |
| 209 | +apiVersion: helm.toolkit.fluxcd.io/v2 |
| 210 | +kind: HelmRelease |
| 211 | +metadata: |
| 212 | + name: mission-control-slack-bot |
| 213 | + namespace: mission-control |
| 214 | +spec: |
| 215 | + interval: 10m |
| 216 | + chart: |
| 217 | + spec: |
| 218 | + chart: mission-control-ai-assistant |
| 219 | + sourceRef: |
| 220 | + kind: HelmRepository |
| 221 | + name: flanksource |
| 222 | + namespace: mission-control |
| 223 | + interval: 10m |
| 224 | + values: |
| 225 | + slack: |
| 226 | + secretName: mission-control-slack-bot-slack |
| 227 | + llm: |
| 228 | + provider: anthropic |
| 229 | + secretName: mission-control-slack-bot-llm |
| 230 | + secretKey: ANTHROPIC_API_KEY |
| 231 | + model: claude-haiku-4-5 |
| 232 | + mcp: |
| 233 | + secretName: mission-control-slack-bot-mcp |
| 234 | +``` |
| 235 | +
|
| 236 | +#### Add a flux Kustomization |
| 237 | +
|
| 238 | +Use a Kustomization to apply the HelmRelease and Secrets together. |
| 239 | +
|
| 240 | +```yaml title="kustomization.yaml" |
| 241 | +apiVersion: kustomize.config.k8s.io/v1beta1 |
| 242 | +kind: Kustomization |
| 243 | +resources: |
| 244 | + - slack-secret.yaml |
| 245 | + - llm-secret.yaml |
| 246 | + - mcp-secret.yaml |
| 247 | + - slack-bot-helm-repository.yaml |
| 248 | + - slack-bot-helm-release.yaml |
| 249 | +``` |
| 250 | +
|
| 251 | +</TabItem> |
| 252 | +</Tabs> |
0 commit comments