This is a straightforward Slackbot designed to facilitate interaction with the Claude API.
- This is designed for use within a single Slack workspace.
- Please note that this project is a work in progress and may have unresolved bugs or incomplete features.
- Responds to mentions
- Calls the Claude API with thread messages
- Processes reactions by emoji
- Image integration (upcoming)
Visit Slack API and create a new app with slack-app-manifest.json
*Note: You'll need to replace some URLs in the manifest file.
- Go to
OAuth & Permissions
and clickInstall App to Workspace
. - Click
Allow
to grant the app the necessary permissions.
*If you don't have a permission to install the app, you need to setup the app with OAuth flow mode and obtain the Bot Token. In this case, the admin of your workspace needs to install the app. For more details, please refer to OAuth flow mode.
- Go to
OAuth & Permissions
and copy theBot User OAuth Access Token
.
- Visit the Claude API Dashboard and create a new API key.
-
Clone the repository.
-
Set the following environment variables:
export SLACK_BOT_TOKEN=<Slack Bot Token you get from the previous step> export SLACK_SIGNING_SECRET=<Get it from Slack App Basic Information> export ANTHROPIC_API_KEY=<Claude API Key you get from the previous step>
-
Run the app with the following command:
npm install npm run dev
-
Invite the bot to a channel and mention the bot to see the response.
You can deploy the app wherever you prefer, as long as the environment supports Node.js or Docker.
Some options can be set with environment variables.
ENVS | default | description |
---|---|---|
CLAUDE_MODEL | claude-3-sonnet-20240229 |
The model name to be used with the Claude API. You can choose from claude-3-opus-20240229 , claude-3-sonnet-20240229 , or claude-3-haiku-20240307 . |
FLAT_RESPONSE | false | If set to true, the bot will respond directly in the channel instead of creating a thread. |
REACTION_EMOJI | thinking_face |
Change the emoji displayed while the bot is processing. |
PORT | 3000 | Port number. |
SKIP_CLAUDE_API | false | If set to true, the bot will skip calling the Claude API and always provide a dummy message. |