Skip to content

AskSlackBot is a Slack bot management system built with Django, FastAPI, and LangGraph Agents, integrated with Slack via the Slack Bolt SDK for Python.

Notifications You must be signed in to change notification settings

kwstasg/AskSlackBot

Repository files navigation

🧠 AskSlackBot

AskSlackBot is a Slack bot management system built with Django, FastAPI, and LangGraph Agents, integrated with Slack via the Slack Bolt SDK for Python.
It supports multiple AI personas by routing users to dedicated API endpoints powered by LangGraph-based agents, which interact with MCP (Multi-Context Processor) tools for advanced reasoning and extensible workflows.

AskSlackBot Overview


Get a quick visual overview of AskSlackBot in action:

AskSlackBot Demo


✨ Key Features

  • 🛠️ Django Backend — Handles Slack user management, persona configurations, and integration settings via an admin interface.
  • 🤖 Slack Bot — Its the main service that interacts with users through the Home Tab, direct messages, and mentions events.
  • FastAPI Services — Provides RESTful endpoints for agent chat handling, health checks, and tool discovery.
  • 🧩 LangGraph Agents — Implements modular, graph-based AI agents for structured reasoning and persona-specific workflows.
  • 🔗 MCP Integration — Connects to external MCP servers for performing computations, data analysis, or other domain-specific tasks.
  • 🧠 Multi-Persona System — Supports multiple bot personas, each with unique endpoints and behaviors. It can even support endpoints from N8N webhooks.
  • 📊 Advanced Math Tools — Includes simple and advanced math operations via MCP servers.

📂 Project Structure

Directory Description
core/ Django project settings and configuration.
personas/ Defines bot personas and their corresponding LangGraph + MCP logic.
slack_bot/ Slack bot logic including event handlers, message processors, and view interactions.
slack_integration/ Django app for managing Slack users, roles, and administrative tools.

⚙️ Deployment Guide

1. Clone the Repository

git clone https://github.com/kwstasg/AskSlackBot.git
cd AskSlackBot

2. Set Up the Virtual Environment

Make sure Python ≥ 3.10 is installed.

python -m venv env
source env/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Copy the environment sample file and update your configuration:

cp .env.sample .env

Update .env with your:

  • Django Settings:
    Configure the SECRET_KEY for Django's security and set DEBUG to True for development or False for production. Specify the database engine (sqlite for development or mysql for production).

  • Database Configuration:
    If using MySQL or MariaDB, provide the database name, user, password, host, and port. For SQLite, no additional configuration is needed.

  • Slack API Tokens:
    Add your Slack Bot Token (SLACK_BOT_TOKEN) and App Token (SLACK_APP_TOKEN) to enable communication with your Slack workspace.
    For guidance on creating a Slack app and retrieving these tokens, refer to the Slack API: Creating and Configuring Apps.

  • LLM Provider Settings:
    Choose the language model provider (LLM_PROVIDER) such as azure or openrouter. Depending on your choice, configure the corresponding API keys, endpoints, and model names.

Make sure to keep sensitive information like API keys and database credentials secure.

5. Apply Django Migrations

python manage.py makemigrations slack_integration
python manage.py migrate

6. Create a Superuser

python manage.py createsuperuser

7. Run the Django Server

python manage.py runserver

8. Run the Slack Bot

python ./slack_bot/main.py

9. Run the LangGraph Demo Agent

python ./personas/generic_bot_agent.py

🧮 Example: MCP Math Tools

AskSlackBot includes demo MCP (Multi-Context Processor) tools to showcase simple and advanced math operations:

  • Simple Math Tools: Addition, subtraction, multiplication, and division.
  • Advanced Math Tools: Power, square root, factorial, average, standard deviation, dot product, and quadratic equation solving.

🧩 Architecture Overview

Slack Workspace
      │
      ▼
 AskSlackBot
      │
 ├── Django Backend
 ├── Slack Bot Event Handlers (Home Tab, DM, Mention)
 ├── Persona Agent Router (Can also support N8N Webhooks and AI Agents)
 ├── FastAPI Services
 ├── LangGraph Generic Agent
 └── MCP Server Connections
        └── Math Demo Tools

🧑‍💻 Tech Stack

  • Python 3.10+
  • Django — Backend management and user data.
  • FastAPI — Lightweight service for MCP/agent endpoints.
  • LangGraph — Framework for building modular AI agent graphs.
  • Slack Bolt (for Python) — Slack SDK integration.
  • SQLite / MariaDB — Database layer.
  • Uvicorn — ASGI server for FastAPI.

📜 License

This project is licensed under the MIT License.

About

AskSlackBot is a Slack bot management system built with Django, FastAPI, and LangGraph Agents, integrated with Slack via the Slack Bolt SDK for Python.

Topics

Resources

Stars

Watchers

Forks

Languages