BriefChief is an intelligent Telegram bot that analyzes your team's chat conversations and automatically identifies task agreements, deadlines, and action items. It seamlessly integrates with Jira to provide context-aware insights powered by AI.
- π Smart Chat Analysis - Uses GPT-4o to analyze conversation history and extract task agreements
- π Jira Integration - OAuth 2.0 authentication with full Jira API access
- π Multi-language Support - Built-in i18n support (English and Russian)
- π Secure Authentication - Token encryption and secure credential management
- π οΈ LangChain Agent - Intelligent agent with Jira tools for context-aware responses
- π Task Tracking - Automatically suggests task updates and status changes
- π¬ Natural Language Processing - Understands context and filters out casual conversations
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Telegram Bot βββββββΆβ LLM Handler βββββββΆβ OpenAI β
β (bot.py) β β (call_llm) β β GPT-4o β
ββββββββββ¬βββββββββ ββββββββββ¬ββββββββββ βββββββββββββββββββ
β β
β β Tools
β βΌ
β ββββββββββββββββββββ
β β Jira Tools β
β β (LangChain) β
β ββββββββββ¬ββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ
β Jira Auth βββββββΆβ Jira Cloud API β
β Server β β (OAuth 2.0) β
βββββββββββββββββββ ββββββββββββββββββββ
- Python 3.10 or higher
- Telegram Bot Token (from @BotFather)
- Telegram API credentials (from my.telegram.org)
- OpenAI API Key
- Jira Cloud account with OAuth 2.0 app configured
- PostgreSQL or file-based storage for tokens
git clone https://github.com/vladmiron85/BriefChief.git
cd briefchiefpip install -r requirements.txtFor the Jira Auth Server:
pip install -r jira_auth_server/requirements.txtCreate a .env file in the root directory:
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
TELEGRAM_SESSION_STRING=your_session_string
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key
# Jira Auth Server URL
JIRA_AUTH_SERVER_URL=http://localhost:5000
# Internal API Key (for secure communication)
INTERNAL_API_KEY=your_generated_internal_api_keyCreate .env file in jira_auth_server/ directory:
# Jira OAuth 2.0 Configuration
JIRA_CLIENT_ID=your_jira_client_id
JIRA_CLIENT_SECRET=your_jira_client_secret
JIRA_REDIRECT_URI=https://yourdomain.com/auth/callback
JIRA_BASE_URL=https://auth.atlassian.com
# Token Encryption
ENCRYPTION_KEY=your_fernet_encryption_key
# Internal API Key (must match bot's key)
INTERNAL_API_KEY=your_generated_internal_api_keyGenerate Telegram Session String:
python generate_session.pyGenerate Encryption Key:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"Generate Internal API Key:
python -c "import secrets; print(secrets.token_urlsafe(32))"- Go to Atlassian Developer Console
- Create a new OAuth 2.0 (3LO) app
- Set callback URL:
http://localhost:5000/auth/callback(for local development) - Add permissions:
read:jira-work,read:jira-user,write:jira-work(the last one is dangerous. don't switch it on during experiments until you 100% sure that your AI agent is fine) - Copy Client ID and Client Secret to your
.envfile
Terminal 1 - Start Jira Auth Server:
cd jira_auth_server
python jira_auth_server.pyTerminal 2 - Start Telegram Bot:
python bot.py/auth- Authenticate with Jira/status- Check your Jira authentication status/brief- Analyze recent chat messages and identify task agreements/test- Test with pre-generated chat history
-
Authenticate with Jira:
User: /auth Bot: π Please authorize with Jira... [User clicks button and completes OAuth flow] Bot: β Authorization Successful! -
Analyze Chat:
User: /brief Bot: Select LLM model: [User selects OpenAI] Bot: Getting chat messages... Bot: Processing messages with OpenAI... Found task agreements: Task: Update login page design State change: New status is In Progress Comment to add: Team agreed to use blue color scheme... Task link: PROJ-123
briefchief/
βββ bot.py # Main Telegram bot
βββ messages.py # i18n message definitions
βββ generate_session.py # Telegram session generator
βββ requirements.txt # Python dependencies
βββ .env.example # Example environment variables
β
βββ LLM/ # LLM and AI logic
β βββ __init__.py
β βββ llm_handler.py # LLM orchestration
β βββ jira_tools.py # Jira LangChain tools
β βββ prompt_system.txt # System prompt
β βββ prompt_user.txt # User prompt template
β
βββ jira_auth_server/ # Jira OAuth server
βββ jira_auth_server.py # Flask auth server
βββ requirements.txt # Auth server dependencies
βββ .env.example # Example auth server config
βββ JIRA_AUTH_README.md # Detailed auth docs
βββ auth_flow_diagram.md # OAuth flow diagram
Edit LLM/prompt_system.txt and LLM/prompt_user.txt to customize how the AI analyzes conversations:
# prompt_system.txt
You are an AI assistant specialized in analyzing chat conversations...
# prompt_user.txt
Your task is to:
1. Read through the provided chat history
2. Identify any agreements made on tasks
3. Summarize changes to be made
...
Edit messages.py to add new language support:
MESSAGES = {
"ru": { ... },
"en": { ... },
"es": { # Add Spanish
"auth_button": "π Autorizar con Jira",
...
}
}- Check if both services are running (bot and auth server)
- Verify
TELEGRAM_BOT_TOKENis correct - Check logs for errors
- Verify OAuth app configuration in Atlassian
- Check
JIRA_CLIENT_IDandJIRA_CLIENT_SECRET - Ensure callback URL matches exactly
- Verify
OPENAI_API_KEYis valid and has credits - Check OpenAI API status
- Review prompt templates for syntax errors
- Regenerate session string with
generate_session.py - Verify
TELEGRAM_API_IDandTELEGRAM_API_HASH
This project is licensed under the MIT License - see the LICENSE file for details.
- python-telegram-bot - Telegram Bot API wrapper
- LangChain - LLM application framework
- OpenAI - GPT-4 API
- Telethon - Telegram client library