Skip to content

quantdevv/assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Assistant for Slack - Complete Implementation

An intelligent Slack chatbot that analyzes conversations, extracts tasks, summarizes discussions, and provides context-aware insights about your work. Built with FastAPI, LLMs (Ollama/OpenAI), and SQLAlchemy.

✨ Features

Core Capabilities

  • Thread Summarization: AI-powered summaries of any Slack thread
  • Task Extraction: Automatically pull actionable items from conversations
  • Context-Aware Q&A: Ask questions and get answers with full context of your work
  • Task Tracking: Create, manage, and track work items
  • Real-time Integration: Responds instantly to mentions in Slack
  • Multi-LLM Support: Works with local Ollama or cloud OpenAI API

What It Can Do

βœ… Summarize long Slack threads with one command
βœ… Extract tasks from conversations automatically
βœ… Answer questions like "What's on my plate?" with full context
βœ… Get daily/weekly work summaries
βœ… Track and manage action items
βœ… Provide smart insights about ongoing work

πŸš€ Quick Start (5 Minutes)

1. Setup

# Copy environment template
cp .env.example .env

# Edit with your Slack tokens
nano .env

2. Install

pip install -r pyproject.toml

3. Run

uvicorn api.main:app --reload

4. Test

python test_api.py

πŸ“‹ Required Configuration

Slack Setup

  1. Go to Slack API
  2. Create a "New App"
  3. Set these scopes under "Bot Token Scopes":
    • chat:write
    • chat:write.public
    • reactions:write
    • search:read
    • users:read
    • channels:read
  4. Enable event subscriptions for:
    • app_mention
    • message.channels
    • message.groups
    • message.im

Environment Variables

# Slack
SLACK_BOT_TOKEN=xoxb-your-token
SLACK_SIGNING_SECRET=your-secret
SLACK_APP_TOKEN=xapp-your-token

# LLM (choose one)
LLM_PROVIDER=local          # Uses Ollama
MODEL_NAME=mistral

# OR
LLM_PROVIDER=openai         # Uses OpenAI
OPENAI_API_KEY=sk-your-key

# Database
DATABASE_URL=sqlite:///./assistant.db

πŸ“‘ API Endpoints

Tasks

POST /tasks/
  Body: {"title": "...", "description": "..."}
  Returns: Created task

GET /tasks/
  Returns: List of all tasks

Summarization

POST /summarize
  Body: {
    "text": "conversation text",
    "store_tasks": true
  }
  Returns: {summary, extracted_tasks}

Slack Threads

GET /memory/slack-threads/user/{user_id}
GET /memory/slack-threads/marked
POST /memory/slack-threads/mark
  Body: {"thread_ts": "...", "is_marked": true}
POST /memory/slack-threads/analyze
  Body: {"thread_ts": "...", "channel_id": "...", "extract_tasks_flag": true}

Chat / Question Answering

POST /chat/ask
  Body: {
    "user_id": "U123",
    "question": "What's on my plate?",
    "channel_id": "C456"  # optional
  }
  Returns: AI-generated response with context

GET /chat/pending-summary/{user_id}
  Returns: Summary of pending tasks

GET /chat/slack-status/{user_id}
  Returns: User's recent Slack activity

πŸ’¬ Using in Slack

@assistant What should I focus on?
@assistant Summarize this thread
@assistant Extract tasks from this
Mark a thread and use API to analyze

πŸ—οΈ Architecture

Slack Events β†’ Slack Bot Handler β†’ FastAPI Server β†’ LLM (Ollama/OpenAI)
                                          ↓
                                    Database (SQLite/PostgreSQL)
                                          ↓
                                   Slack Notifications

Core Components

  • API Routes: FastAPI endpoints for all operations
  • Slack Bot: Event handler for real-time interactions
  • LLM Provider: Integration with Ollama (local) or OpenAI
  • Context Builder: Builds smart context from tasks and threads
  • Database: SQLAlchemy ORM with Task and SlackThread models
  • Notifier: Sends responses back to Slack

πŸ“ Project Structure

assistant/
β”œβ”€β”€ api/routes/              # API endpoints
β”‚   β”œβ”€β”€ tasks.py
β”‚   β”œβ”€β”€ summarize.py
β”‚   β”œβ”€β”€ memory.py
β”‚   └── conversation.py
β”œβ”€β”€ core/                    # Core logic
β”‚   β”œβ”€β”€ slack_bot.py        # Event handler
β”‚   β”œβ”€β”€ llm_provider.py     # LLM integration
β”‚   β”œβ”€β”€ context_builder.py  # Context logic
β”‚   β”œβ”€β”€ summarizer.py       # Summarization
β”‚   └── task_extractor.py   # Task extraction
β”œβ”€β”€ connectors/              # External APIs
β”‚   └── slack_client.py     # Slack API wrapper
β”œβ”€β”€ memory/                  # Data layer
β”‚   β”œβ”€β”€ models.py
β”‚   └── repository.py
β”œβ”€β”€ notifications/           # Slack messaging
β”‚   └── notifier.py
β”œβ”€β”€ config/                  # Configuration
β”‚   └── database.py
└── utils/                   # Utilities
    └── logger.py

πŸ”§ Technology Stack

Layer Technology
API FastAPI, Uvicorn
Database SQLAlchemy, SQLite (dev) / PostgreSQL (prod)
Slack slack-sdk, slack-bolt
LLM Ollama (local) + OpenAI (cloud)
Language Python 3.12+

πŸ“Š Database Models

Task

- id (primary key)
- title (required)
- description (optional)
- status (pending/completed/in-progress)
- created_at

SlackThread

- id (primary key)
- thread_ts (unique)
- channel_id
- user_id
- user_name
- channel_name
- summary
- is_marked
- created_at
- updated_at

πŸ“š Documentation

Guide Purpose
QUICK_START.md 5-minute quick start
SETUP_GUIDE.md Complete setup & configuration
QUICK_REFERENCE.md API reference & common tasks
ARCHITECTURE.md System design & data flows
IMPLEMENTATION_NOTES.md Technical details & next steps
COMPLETION_CHECKLIST.md Feature checklist & status

βœ… Verification Checklist

# 1. Install dependencies
pip install -r pyproject.toml

# 2. Configure .env
cp .env.example .env
# Edit with Slack tokens

# 3. Start server
uvicorn api.main:app --reload

# 4. Run tests (in another terminal)
python test_api.py

# 5. Test in Slack
# Mention bot: @assistant What's on my plate?

πŸ› οΈ Development

Add New Endpoint

  1. Create file in api/routes/
  2. Define route handler
  3. Register in api/main.py

Customize LLM Prompts

Edit core/summarizer.py and core/task_extractor.py

Switch Database

Update DATABASE_URL in .env:

# SQLite (dev)
DATABASE_URL=sqlite:///./assistant.db

# PostgreSQL (prod)
DATABASE_URL=postgresql://user:password@localhost/dbname

πŸš€ Next Steps

Immediate

  • Complete Quick Start
  • Configure Slack tokens
  • Run test suite
  • Test with your Slack workspace

Short Term

  • Customize prompts for your domain
  • Add conversation history
  • Implement task priorities
  • Create scheduled summaries

Medium Term

  • Migrate to PostgreSQL
  • Add user authentication
  • Implement background jobs
  • Create analytics dashboard

Long Term

  • Multi-workspace support
  • Outlook Calendar integration
  • Advanced analytics
  • Mobile app

πŸ› Troubleshooting

Bot not responding in Slack

  • Verify SLACK_BOT_TOKEN is correct
  • Ensure bot is in the channel
  • Check logs in console

Summarization fails

  • Ensure Ollama is running (if using local)
  • Verify OpenAI API key (if using cloud)
  • Check LLM_PROVIDER setting

API errors

  • Check all .env variables
  • Run test_api.py to diagnose
  • Review logs in server console

πŸ“ˆ Performance Tips

  1. Use local LLM (Ollama) for privacy and speed
  2. Start with SQLite, migrate to PostgreSQL when needed
  3. Cache frequently accessed data (future enhancement)
  4. Batch process long conversations

πŸ”’ Security Considerations

  • Store tokens in .env (never commit)
  • Use environment variables for secrets
  • Implement authentication for production
  • Use HTTPS in production
  • Validate all inputs

πŸ“ License

MIT License - See LICENSE file

🀝 Contributing

Feel free to extend with:

  • New endpoints
  • Additional integrations (Outlook, Teams, etc.)
  • Advanced analytics
  • Custom workflows
  • Improved prompts

πŸ“ž Support

  • Check documentation files
  • Review code comments
  • Run test suite for diagnostics
  • Check server logs

πŸŽ“ Learning Resources


πŸ“Š Project Status

βœ… Core Features: Complete
βœ… API Implementation: Complete
βœ… Slack Integration: Complete
βœ… Database Layer: Complete
βœ… Documentation: Comprehensive
βœ… Testing: Test suite included

Status: Ready for Production (with auth additions)
Version: 1.0.0
Last Updated: 2026-02-25


Ready to get started? Head to QUICK_START.md AI assistant is a tool which helps person to summarize his slack conversation, outlook email & track thread conversion, zoom conversation & can crate task behalf of that.

About

AI assistant is a tool which helps person to summarize his slack conversation, outlook email & track thread conversion, zoom conversation & can crate task behalf of that.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages