Ramesh Inampudi

Tools

A Telegram Check-In Bot for UPSC Mentorship with n8n

By Ramesh Inampudi · 2026-10-28 · 4 min read

Mentorship programs for competitive exams run on accountability. A mentor wants to know whether a student set a target in the morning, how many hours they actually studied, and whether the day was full, partial or lost. With a handful of students you can ask each one directly. With 80 or more, the follow-up becomes a job in itself. BOT_RAG_NOTIFY is my attempt to remove that manual work: a Telegram bot, driven by n8n, that asks the questions, records the answers in Google Sheets and sends each student a weekly summary.

Why I built it

The project was designed for LA Excellence IAS Academy, which tracks study progress across more than 80 UPSC aspirants. The problem was not a lack of data; it was the effort of collecting it consistently. Messages had to go out at the same times every day, replies had to be gathered somewhere a mentor could read them, and students needed some feedback in return or they would stop answering.

I chose Telegram because students already use it and its Bot API supports inline keyboard buttons. Buttons matter here. A free-text question such as "how was your day?" gets inconsistent answers that are hard to tally. A tap on a fixed option gives you a clean value to store.

What it does

The system handles three daily touchpoints, all in IST:

Replies are written to a shared Google Sheet as they arrive. Every Sunday at 10:00 AM, each student receives a personalised weekly performance summary. None of this needs anyone to press a button on the mentor's side.

The five evening questions cover hours studied, subjects covered, whether a test was written, a productivity rating from 1 to 5, and the overall status of the day (fully done, partially done or not done).

How it works

The stack

The pieces are deliberately few: the Telegram Bot API for messaging, n8n as the automation engine (self-hosted or n8n Cloud), Google Sheets for storage, and ngrok to expose a local n8n instance to Telegram during development. Python and Shell handle setup tasks around the edges.

Five workflows

The logic lives in five n8n workflow files, one per responsibility:

  1. 01_morning_checkin.json - the 7 AM target question.
  2. 02_afternoon_nudge.json - the 2 PM message.
  3. 03_night_checkin.json - the 9:30 PM button questions.
  4. 04_capture_replies.json - an always-on listener for messages and button taps that writes to Google Sheets.
  5. 05_weekly_summary.json - the Sunday report.

Splitting by responsibility keeps each workflow small enough to read at a glance. The three outbound workflows are simple scheduled jobs. The one that does the hard work is the capture workflow, which has to stay live around the clock.

Encoding answers in callback data

Each inline button carries a short callback_data string, and the capture workflow maps those strings to sheet columns. For example, hours studied uses hours_lt4, hours_4to6, hours_6to8 and hours_8plus; productivity uses prod_1 through prod_5; the day status uses status_full, status_partial and status_notdone. A consistent prefix per question means the listener can tell which column a tap belongs to without any parsing beyond the string itself. It is a pattern worth borrowing for any button-driven bot.

The data model

The Google Sheet has two tabs. A Student Registry holds each student's name, Telegram chat ID, batch group, start date and optional subject. A Daily Responses tab holds one row per student per day, with columns for the morning target, planned hours, evening status, hours completed, subjects covered, test written, productivity and a timestamp. The outbound workflows read the registry to know who to message; the capture workflow writes to the responses tab.

Activation order

The capture workflow must be imported and activated first, because the webhook listener has to be live before any outbound message produces a reply. The order is 04, then 01, 02, 03 and 05.

Local development and setup helpers

For local runs, Telegram needs a public HTTPS address to deliver updates to, which is what ngrok provides. Because a free tunnel URL can change, the repository includes fix_webhook.py to re-point the Telegram webhook at the current URL, and start_n8n.sh to start n8n with the webhook configuration. There is also cloud_setup_assistant.py, which uses the Anthropic Claude API to guide the import of workflows, connection of credentials and activation. It is optional; a manual setup path is documented step by step. Credentials go in a cred.env file copied from a template, so secrets stay out of the repository.

What I learned

Conclusion

BOT_RAG_NOTIFY is a small system built from ordinary parts: scheduled messages, tappable buttons, a spreadsheet and a weekly summary. The value is in how the parts are divided, with one always-on listener, three scheduled senders and one reporter, and in keeping the answer format rigid enough to count. If you run a program that depends on regular check-ins, the same structure should transfer with little change. For questions, you can reach me at hello@iramesh.com.