Sophia is a Slack bot that analyzes past messages to automatically generate helpful responses, allowing users to quickly resolve common or repeated questions without waiting for someone else to reply.
This project was built as part of a hackathon at Foreman.
- Automatically suggests answers based on past Slack conversations
- Helps reduce repeated questions
- Integrates seamlessly with Slack using the Bolt.js framework
- Can be extended with custom logic or AI integrations (e.g. OpenAI API, Gemini, etc)
- Go to https://app.slack.com/ and sign in to your Slack workspace
- Navigate to https://api.slack.com/apps
- Click "Create New App" → "From manifest"
- Select your workspace/organization to link the app to
- Copy and paste the contents of
manifest.jsoninto the manifest editor - Click "Create" to create the app
- In your app's settings, go to "OAuth & Permissions" under "Features"
- Scroll down to "Bot User OAuth Token" and copy the token (starts with
xoxb-) - Go to "Basic Information" → scroll to "App-Level Tokens"
- Click "Generate Token and Scopes"
- Name it (e.g., "socket-mode") and add the
connections:writescope - Copy the generated token (starts with
xapp-)
git clone https://github.com/<your-org-or-username>/ask-sophia.git
cd ask-sophiapip install -r requirements.txtCreate a .env file in the root directory with the following variables:
SLACK_BOT_TOKEN=xoxb-your-bot-token-here
SLACK_APP_TOKEN=xapp-your-app-token-here
GEMINI_API_KEY=your-gemini-api-key-here
GEMINI_MODEL=your-gemini-model-nameReplace the placeholder values with:
SLACK_BOT_TOKEN: The Bot User OAuth Token from step 2SLACK_APP_TOKEN: The App-Level Token from step 2GEMINI_API_KEY: Your Google Gemini API key (get it from Google AI Studio)GEMINI_MODEL: The Gemini model name (e.g.,gemini-pro,gemini-1.5-pro)
python sophia.py