-
Notifications
You must be signed in to change notification settings - Fork 2
feat: slack bot #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: slack bot #463
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,228 @@ | ||
| --- | ||
| title: Slack Bot | ||
| sidebar_custom_props: | ||
| icon: slack | ||
| --- | ||
|
|
||
| import Tabs from '@theme/Tabs' | ||
| import TabItem from '@theme/TabItem' | ||
|
|
||
| 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. | ||
|
|
||
| ## Slack app creation and installation | ||
|
|
||
| ### Before you start | ||
|
|
||
| - A Slack workspace where you can create apps | ||
| - An Anthropic, OpenAI, or Google Generative AI API key for the LLM provider | ||
|
|
||
|
|
||
| ### Create the Slack app | ||
|
|
||
| 1. Go to [api.slack.com/apps](https://api.slack.com/apps) and select **Create New App**. | ||
| 2. Choose **From scratch**, name the app, and select the workspace. | ||
| 3. Select **Create App**. | ||
|
|
||
|  | ||
|
|
||
| ### Enable Socket Mode | ||
|
|
||
| Open **Settings** → **Socket Mode** and turn on **Enable Socket Mode**. | ||
|
|
||
| You'll be prompted to generate an app-level token with access to the `connections:write` scope. | ||
|
|
||
|  | ||
|
|
||
| Store the token value as `SLACK_APP_TOKEN` env var. | ||
|
|
||
| ### Enable App Home messages | ||
|
|
||
| Open **Features** → **App Home** and enable these settings: | ||
|
|
||
| - **Messages Tab** | ||
| - **Allow users to send Slash commands and messages from the messages tab** | ||
|
|
||
| These settings let users send direct messages to the bot from the App Home Messages tab. Without them, Slack disables messages to the app. | ||
|
|
||
| ### Add bot token scopes | ||
|
|
||
| Open **Features** → **OAuth & Permissions** and add these bot token scopes: | ||
|
|
||
| | Scope | Description | | ||
| | --- | --- | | ||
| | `app_mentions:read` | View messages that directly mention @Mission Control AI Assistant in conversations that the app is in. | | ||
| | `chat:write` | Send messages as @Mission Control AI Assistant. | | ||
| | `groups:history` | View messages and other content in private channels that Mission Control AI Assistant has been added to. | | ||
| | `im:history` | View messages and other content in direct messages that Mission Control AI Assistant has been added to. | | ||
| | `im:read` | View basic information about direct messages that Mission Control AI Assistant has been added to. | | ||
| | `im:write` | Start direct messages with people. | | ||
|
|
||
| ### Add bot events | ||
|
|
||
| Open **Features** → **Event Subscriptions**, enable events, and subscribe the bot to these events: | ||
|
|
||
| | Event name | Description | Required scope | | ||
| | --- | --- | --- | | ||
| | `app_mention` | Subscribe to only the message events that mention your app or bot. | `app_mentions:read` | | ||
| | `message.im` | A message was posted in a direct message channel. | `im:history` | | ||
|
|
||
| ### Install the app | ||
|
|
||
| Finally, you can go back to **Features** → **OAuth & Permissions** and select **Install to Workspace**. | ||
|
|
||
| After installation, you'll see the Bot User OAuth Token (starts with `xoxb-`) on that same page. | ||
| Store the token value as `SLACK_BOT_TOKEN` env var. | ||
|
|
||
| ## Mission Control MCP URL and token | ||
|
|
||
| You need the MCP URL and bearer token to connect the bot to Mission Control tools. | ||
|
|
||
| ### Get the MCP URL and token | ||
|
|
||
| Use the Setup MCP flow to get both values. | ||
|
|
||
| 1. In Mission Control, open the user menu and select **Setup MCP**. | ||
| 2. Select **Create new token**. | ||
| 3. In the token details dialog, select **Slack Bot** and copy `MCP_URL` and `MCP_BEARER_TOKEN`. | ||
|
|
||
|  | ||
|
|
||
| ## Deployment | ||
|
|
||
| #### Create the Kubernetes Secret (Helm and Flux) | ||
|
|
||
| Create one Secret for Slack, LLM, and MCP credentials before you deploy with Helm or Flux. | ||
|
|
||
| ```yaml title="slack-bot-secret.yaml" | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: slack-bot | ||
| type: Opaque | ||
| stringData: | ||
| SLACK_BOT_TOKEN: xoxb-your-bot-token | ||
| SLACK_APP_TOKEN: xapp-your-app-token | ||
| ANTHROPIC_API_KEY: sk-ant-your-api-key | ||
| MCP_URL: https://mission-control.example.com/mcp | ||
| MCP_BEARER_TOKEN: your-mcp-token | ||
| ``` | ||
|
|
||
| <Tabs> | ||
| <TabItem label="kubectl Helm release" value="helm" default> | ||
|
|
||
| ### Create Secrets | ||
|
|
||
|
|
||
| ```bash title="Apply the Slack bot secrets" | ||
| kubectl apply -f slack-bot-secret.yaml | ||
| ``` | ||
|
|
||
| #### Create the values file | ||
|
|
||
| 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. | ||
|
|
||
| ```yaml title="slack-bot-values.yaml" | ||
| slack: | ||
| secretName: slack-bot | ||
| llm: | ||
| provider: anthropic | ||
| secretName: slack-bot | ||
| secretKey: ANTHROPIC_API_KEY | ||
| model: claude-haiku-4-5 | ||
| mcp: | ||
| secretName: slack-bot | ||
| ``` | ||
|
|
||
| #### Add the Helm repository | ||
|
|
||
| Add the Flanksource Helm repository so Helm can find the Slack bot chart. | ||
|
|
||
| ```bash title="Add the Flanksource Helm repository" | ||
| helm repo add flanksource https://flanksource.github.io/charts | ||
| ``` | ||
|
|
||
| #### Update the Helm repository | ||
|
|
||
| Update the Helm repository index so Helm can install the latest chart version. | ||
|
|
||
| ```bash title="Update the Helm repository index" | ||
| helm repo update flanksource | ||
| ``` | ||
|
|
||
| This command refreshes the `flanksource` repository metadata on your workstation. | ||
|
|
||
| #### Install the chart | ||
|
|
||
| Install the chart from the Flanksource Helm repository so Kubernetes runs the deployment with your values. | ||
|
|
||
| ```bash title="Install the Slack bot chart" | ||
| helm upgrade --install mission-control-slack-bot flanksource/mission-control-ai-assistant -f slack-bot-values.yaml -n mission-control --create-namespace | ||
| ``` | ||
|
|
||
| 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. | ||
|
|
||
| </TabItem> | ||
| <TabItem label="Flux Helm release" value="flux"> | ||
|
|
||
| #### Create the HelmRepository | ||
|
|
||
| Define the Flanksource Helm repository so Flux can fetch the chart. | ||
|
|
||
| ```yaml title="slack-bot-helm-repository.yaml" | ||
| apiVersion: source.toolkit.fluxcd.io/v1 | ||
| kind: HelmRepository | ||
| metadata: | ||
| name: flanksource | ||
| namespace: mission-control | ||
| spec: | ||
| interval: 10m | ||
| url: https://flanksource.github.io/charts | ||
| ``` | ||
|
|
||
| #### Create the HelmRelease | ||
|
|
||
| Create a HelmRelease that points to the Slack bot chart and sets the values for your Slack and LLM credentials. | ||
|
|
||
| ```yaml title="slack-bot-helm-release.yaml" | ||
| apiVersion: helm.toolkit.fluxcd.io/v2 | ||
| kind: HelmRelease | ||
| metadata: | ||
| name: mission-control-slack-bot | ||
| namespace: mission-control | ||
| spec: | ||
| interval: 10m | ||
| chart: | ||
| spec: | ||
| chart: mission-control-ai-assistant | ||
| sourceRef: | ||
| kind: HelmRepository | ||
| name: flanksource | ||
| namespace: mission-control | ||
| interval: 10m | ||
| values: | ||
| slack: | ||
| secretName: slack-bot | ||
| llm: | ||
| provider: anthropic | ||
| secretName: slack-bot | ||
| secretKey: ANTHROPIC_API_KEY | ||
| model: claude-haiku-4-5 | ||
| mcp: | ||
| secretName: slack-bot | ||
| ``` | ||
|
|
||
| #### Add a flux Kustomization | ||
|
|
||
| Use a Kustomization to apply the HelmRelease and Secrets together. | ||
|
|
||
| ```yaml title="kustomization.yaml" | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
| resources: | ||
| - slack-bot-secret.yaml | ||
| - slack-bot-helm-repository.yaml | ||
| - slack-bot-helm-release.yaml | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.