An automated AI mentor that intercepts your accepted LeetCode submissions in real-time, requests a structured complexity & code review from DeepSeek Coder, and delivers a beautifully formatted report straight to your Telegram chat.
This version is designed as a multi-user ready system. The Chrome Extension allows each user to configure their own Telegram Chat ID and DeepSeek API Key, so you can share the extension with others without paying for their API usage!
This project consists of two halves:
- The Chrome/Edge Extension (Client-side settings & trigger)
- The n8n Workflow (Server-side orchestrator)
Each person who wants to use the extension should follow these steps:
To authorize the bot to send you messages:
- Open Telegram and search for the bot username provided by the host.
- Click Start (or send a message).
- Search for
@userinfoboton Telegram and send it any message. - Copy the Id (a string of numbers like
7731571949) that it sends back.
- Go to the DeepSeek Developer Platform.
- Create an account, navigate to API Keys, and generate a new key.
- Copy the key (it starts with
sk-).
- Download the
leetcode-mentorextension folder. - Open Chrome or Edge and navigate to the extensions page:
- Chrome:
chrome://extensions/ - Edge:
edge://extensions/
- Chrome:
- Toggle Developer mode (top-right corner) to ON.
- Click Load unpacked (top-left corner) and select the
leetcode-mentorfolder. - In your browser toolbar, click the Puzzle Piece π§© icon, find LeetCode Mentor, and click the Pin (Eye) icon to show it on your bar.
- Click the robot icon in your toolbar to open the settings:
- Paste your Telegram Chat ID from Step 1.
- Paste your DeepSeek API Key from Step 2.
β οΈ IMPORTANT: Do NOT include the wordBearerin this box. Just paste the raw key (e.g.sk-...).
- Click Save Settings.
If you are hosting the n8n server:
- Open Telegram, search for @BotFather, and send
/newbot. - Choose a name and username for your bot.
- Save the API Token BotFather gives you.
- Launch n8n:
Run the startup command in your terminal:
(Open http://localhost:5678 in your browser once started).
npx n8n start
- Import the Workflow:
- Create a new, blank workflow in n8n.
- Copy the entire content of n8n-workflow.json from this project folder.
- Click inside your n8n workspace grid canvas and press
Ctrl + Vto paste it.
- Configure Bot Credentials:
- Double-click the Telegram Send node.
- Under Credential for Telegram API, click "Create New Credential" and paste your Telegram API Token from Step 1. Save it.
- (Note: The Chat ID is now dynamic and is automatically extracted from the incoming extension webhook payload).
- Save and activate the workflow.
- Copy the webhook URL from the Webhook Trigger node in n8n (use the Test URL for testing, and Production URL for permanent hosting).
- In the extension folder, open leetcode-mentor/content.js and set the URL on line 4:
const N8N_WEBHOOK_URL = 'https://your-hosted-n8n-domain/webhook/leetcode-mentor';
- Save the file.
- In n8n, click Listen for test event on the Webhook node (if testing).
- Open LeetCode, pick any problem (like Two Sum).
- Submit a correct solution.
- The Telegram bot will immediately send your review!
This workflow uses a clean HTML Parse Mode to deliver visually stunning cards to Telegram:
- No Parser Crashes: Automatically translates raw
<and>code brackets (likevector<int>) into HTML entities so the API does not error out. - Syntax Highlighted Code blocks: Optimal solutions are wrapped inside
<pre><code class='language-[lang]'>for native syntax boxes in mobile and desktop. - Short Line Wrapping: Code lines are restricted to 45β50 characters so they don't break awkwardly on narrow mobile screens.
- Dynamic Key Takeaway: Summarizes the single most important lesson from the problem in one sentence.
- Motivational Quote: Appends an inspiring programming quote at the end of the review.
Before pushing this repository to a public GitHub repository, verify you haven't committed secrets:
- n8n Workflow Configuration: The template file n8n-workflow.json is clean and uses placeholders (
YOUR_TELEGRAM_CREDENTIAL_ID). Your Telegram Token and user API Keys are stored safely only inside n8n's local database and the Chrome Extension storage, keeping them out of your Git history!