Skip to content

0xgordian/bot-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bot Stack

A Slack bot built with Python, Flask, and Slack Bolt

Available Features

Automated Notifications & Alerts

  • Daily standup reminders (weekdays at 9:00 AM)
  • Weekly deadline alerts (Fridays at 5:00 PM)
  • GitHub commit notifications (via command)

Slash Commands

  • /todo add <task> - Add tasks to your personal todo list
  • /todo list - View your current todos
  • /translate <text> - Translate text to English
  • /faq <question> - Get answers to common questions
  • /poll Question | option1, option2, ... - Create interactive polls
  • /github owner/repo - Check recent commits
  • /calendar - View upcoming calendar events
  • /joke - Get a random joke
  • /encourage - Receive motivational messages

Interactive Messages

  • Poll voting with buttons
  • Real-time vote tracking

External API Integrations

  • GitHub API for commit monitoring
  • Google Calendar API (mock implementation)
  • Translation API (LibreTranslate)
  • Joke API for entertainment

What You'll Need

Required

  • Python 3.8+ installed on your system
  • Slack Workspace: Where you can create and install apps
  • Slack Bot Token (xoxb-...): From your Slack app's OAuth settings
  • Slack Signing Secret: 32-character string from your Slack app

Optional ( optional features )

  • GitHub Personal Access Token: For /github command (repo scope)
  • Google Calendar API Key: For /calendar command

For Local Development

  • ngrok or similar tunneling service to expose localhost to Slack

Tech Stack Used

  • Python 3.8+
  • Flask - Web framework
  • Slack Bolt - Slack app framework
  • APScheduler - Task scheduling
  • Requests - HTTP client for APIs

Quick Start

Prerequisites

  • Python 3.8 or higher
  • A Slack workspace where you can install apps

1. Clone the Repository

git clone https://github.com/yourusername/bot-stack.git
cd bot-stack

2. Install Dependencies

pip install -r requirements.txt

3. Set Up Slack App

  1. Go to api.slack.com/apps and create a new app
  2. Add bot token scopes: chat:write, commands, channels:read, groups:read, im:read, mpim:read
  3. Install the app to your workspace
  4. Copy the Bot User OAuth Token and Signing Secret

4. Configure Environment Variables

cp .env.example .env

Edit .env and add your tokens:

SLACK_BOT_TOKEN=xoxb-your-bot-token-here
SLACK_SIGNING_SECRET=your-signing-secret-here
GITHUB_TOKEN=your-github-personal-access-token (optional)
GOOGLE_CALENDAR_API_KEY=your-google-api-key (optional)

5. Run Locally

python app.py

The bot will start on http://localhost:3000.

6. Set Up Local Development with Slack

For Slack to send events to your local server, use ngrok:

# Install ngrok from https://ngrok.com/
ngrok http 3000

Copy the ngrok URL (e.g., https://abc123.ngrok.io) and set it as the Request URL in your Slack app's Event Subscriptions: https://abc123.ngrok.io/slack/events

Deployment

Render (Recommended)

  1. Connect your GitHub repository to Render
  2. Set environment variables in Render dashboard
  3. Deploy with the following settings:
    • Runtime: Python 3
    • Build Command: pip install -r requirements.txt
    • Start Command: python app.py

Railway

  1. Connect GitHub repo
  2. Add environment variables
  3. Railway will auto-detect Python and deploy

Other Platforms

The app can be deployed to any platform supporting Python/Flask:

  • Heroku
  • DigitalOcean App Platform
  • AWS Elastic Beanstalk

Project Structure

bot-stack/
├── app.py              # Main Flask application with Slack Bolt handlers
├── features.py         # Core bot features and API integrations
├── config.py           # Configuration and environment variable loading
├── requirements.txt    # Python dependencies
├── .env.example        # Environment variables template
└── README.md          # This file

API Keys & Tokens

Required

  • SLACK_BOT_TOKEN: Bot user OAuth token from Slack app
  • SLACK_SIGNING_SECRET: App signing secret from Slack

Optional

  • GITHUB_TOKEN: Personal access token for GitHub API (repo scope)
  • GOOGLE_CALENDAR_API_KEY: API key for Google Calendar integration

Usage Examples

/todo add Review pull request #123
/todo list
/translate Hello, how are you?
/faq how to reset password
/poll What's for lunch? | Pizza, Sushi, Burgers
/github octocat/Hello-World
/calendar
/joke
/encourage

Development

Adding New Features

  1. Add feature functions to features.py
  2. Create command handlers in app.py
  3. Update README with new commands

Testing

# Run with debug mode
python app.py

Code Quality

  • Follow PEP 8 style guidelines
  • Add docstrings to all functions
  • Handle errors gracefully
  • Use environment variables for configuration

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

MIT License - feel free to use this project for learning and portfolio purposes.

Author

Built by 0xgordian - ASlack bot called Bot Stack built in Python

About

Bot Stack is a Slack bot built with Python, Flask, and Slack Bolt. It automates routine team updates and notifications inside Slack, helping teams stay on track without manual reminders.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages