11# Cursor AI Telegram Bot
22
3- A powerful Telegram bot for managing Cursor AI Background Composers with intelligent task management and real-time monitoring.
3+ A powerful Telegram bot for managing Cursor Background Agents with intelligent task management and real-time monitoring.
44
55## ✨ Features
66
7- - 🤖 ** AI Task Management** : Start, monitor, and manage Cursor AI coding tasks
8- - 🔐 ** Secure Authentication** : Cookie-based authentication with validation
9- - 📊 ** Real-time Monitoring** : Automatic task progress tracking and notifications
10- - 💬 ** Interactive Interface** : Telegram buttons for external links and actions
11- - 🛡️ ** Security** : Repository and user access control via environment variables
12- - 📱 ** User-friendly** : Simple commands with rich status information
13- - 🎤 ** Voice Messages** : AI-powered voice message transcription using Gemini
14- - 📸 ** Image Support** : Send photos to include in Cursor AI tasks (cached for 3 minutes)
15- - ⚙️ ** Customizable** : Custom prompts and instructions via environment variables
7+ - ** AI Task Management** : Start, monitor, follow up, and manage Cursor AI tasks
8+ - ** Secure Authentication** : Official API via ` CURSOR_API_KEY ` (no cookies)
9+ - ** Real-time Monitoring** : Automatic task progress tracking and notifications
10+ - ** Interactive Interface** : Telegram buttons for external links and actions
11+ - ** Security** : Repository and user access control via environment variables
12+ - ** User-friendly** : Simple commands with rich status information
13+ - ** Voice Messages** : AI-powered voice message transcription using Gemini
14+ - ** Image Support** : Send photos to include in Cursor AI tasks (cached for 3 minutes)
15+ - ** Customizable** : Custom prompts and instructions via environment variables
1616
1717### Quick Setup:
1818
19191 . ** Create Telegram Bot** : Message [ @BotFather ] ( https://t.me/BotFather ) → ` /newbot `
20202 . ** Get your User ID** : Message [ @userinfobot ] ( https://t.me/userinfobot )
21- 3 . ** Deploy** : Click Railway button, add your ` BOT_TOKEN ` and ` OPENROUTER_API_KEY `
21+ 3 . ** Deploy** : Click Railway button, add your ` BOT_TOKEN ` , ` OPENROUTER_API_KEY ` , and ` CURSOR_API_KEY `
22224 . ** Volume** : Railway will auto-create volume for ` /app/data ` (SQLite database storage)
23- 5 . ** Setup Cursor cookies** : Send your ` WorkosCursorSessionToken ` to the bot
23+ 5 . Done — no cookies required
2424
2525## 🛠️ Local Development
2626
@@ -40,6 +40,7 @@ Create `.env` file:
4040# Required
4141BOT_TOKEN=your_telegram_bot_token_here
4242OPENROUTER_API_KEY=your_openrouter_api_key_here
43+ CURSOR_API_KEY=your_cursor_api_key_here
4344
4445# Optional: OpenRouter model (default: openai/gpt-4.1)
4546OPENROUTER_MODEL=openai/gpt-4.1
@@ -57,17 +58,7 @@ GOOGLE_GENERATIVE_AI_API_KEY=your_google_api_key_here
5758CUSTOM_PROMPT="Focus on repos with skipcalls prefix if user asks to add something"
5859```
5960
60- ### 3. Setup Cursor API Cookies
61-
62- 1 . Go to [ https://cursor.com/agents ] ( https://cursor.com/agents )
63- 2 . Open Developer Tools (F12)
64- 3 . Go to Network tab
65- 4 . Refresh the page
66- 5 . Find any request to cursor.com
67- 6 . Copy the entire Cookie header value
68- 7 . Send it to the bot. YOU NEED ONLY WorkosCursorSessionToken cookie value. Send it in format WorkosCursorSessionToken=...
69-
70- ### 4. Run the Bot
61+ ### 3. Run the Bot
7162
7263``` bash
7364pnpm run build
@@ -80,7 +71,6 @@ pnpm start
8071| ---------| -------------|
8172| ` /start ` | Welcome message and setup guide |
8273| ` /tasks ` | View your active tasks |
83- | ` /cookies ` | Get cookie setup instructions |
8474| ` /help ` | Show available commands |
8575| 🎤 ** Voice Messages** | Send voice messages for AI transcription and processing |
8676
@@ -91,6 +81,9 @@ pnpm start
9181| ` BOT_TOKEN ` | Yes | Telegram bot token from @BotFather |
9282| ` OPENROUTER_API_KEY ` | Yes | OpenRouter API key for AI functionality |
9383| ` OPENROUTER_MODEL ` | No | OpenRouter model (default: 'openai/gpt-4.1') |
84+ | ` CURSOR_API_KEY ` | Yes | API key for official Cursor Background Agents API |
85+ | ` CURSOR_REPOS_TTL_MS ` | No | In-memory cache TTL for ` /v0/repositories ` (default: 60000) |
86+ | ` CURSOR_MODELS_TTL_MS ` | No | In-memory cache TTL for ` /v0/models ` (default: 7200000, i.e. 2 hours) |
9487| ` ALLOWED_REPOS ` | No | Comma-separated list of allowed repository URLs |
9588| ` ALLOWED_USERS ` | No | Comma-separated list of allowed Telegram user IDs |
9689| ` DB_PATH ` | No | Database file path (defaults to 'bot.db', Railway: '/app/data/bot.db') |
@@ -99,9 +92,8 @@ pnpm start
9992
10093## 🛡️ Security
10194
102- - ** No Cookie Exposure** : The bot never exposes actual cookie values
95+ - ** No Secrets Exposure** : The bot never exposes API keys or secrets
10396- ** Repository/User Control** : Optional repository and user access control via environment variables
104- - ** Authentication Validation** : Cookies are validated before every operation
10597- ** Operation Tracking** : All actions are logged for audit purposes
10698
10799## 📖 Usage Examples
@@ -160,7 +152,7 @@ Bot: 📊 Active Tasks (2):
160152
161153## 🔄 Task Lifecycle
162154
163- 1 . ** Start** : Create background composer task in repository
155+ 1 . ** Start** : Create background agent task in repository
1641562 . ** Monitor** : Real-time status tracking and updates
1651573 . ** Notify** : Automatic notifications on completion/failure
1661584 . ** Manage** : Stop or cancel running tasks as needed
@@ -191,7 +183,7 @@ The bot uses SQLite with the following main tables:
191183## 📝 API Integration
192184
193185The bot integrates with:
194- - ** Cursor API** : For background composer management
186+ - ** Cursor API** : For Background Agents management (official API)
195187- ** OpenRouter API** : For AI-powered interactions
196188- ** Telegram Bot API** : For messaging and user interface
197189
@@ -215,4 +207,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
215207
216208---
217209
218- ** Ready to supercharge your Cursor AI workflow with intelligent automation!** 🚀
210+ ** Ready to supercharge your Cursor AI workflow with intelligent automation!** 🚀
0 commit comments