At IIT Patna, class cancellations were handled entirely through manual communication. A faculty member would inform the academic office, who would then manually compose and send an email to each affected student group โ a process that took 10โ15 minutes per cancellation and required someone to be available at a computer at all times.
With 60+ active courses across programmes and 10,000+ enrolled students, even a single missed or delayed cancellation notice caused student confusion, unnecessary travel, and support tickets to the academic office.
The manual process also had no audit trail โ there was no reliable record of which classes had been cancelled, when the notice was sent, or who was notified.
I designed and built a complete end-to-end automation system that reduces the entire cancellation workflow to a single WhatsApp message. The system is triggered by me โ not faculty directly โ which ensures message quality and prevents accidental triggers from unrelated WhatsApp activity.
The message format is simple and consistent: Course Code | Date | Cancelled. Within seconds of sending, the system automatically looks up the course in the master database, identifies all associated email aliases, composes a formatted cancellation notice, and sends it โ all without any manual intervention.
The WhatsApp bot listens for messages sent by the operator and triggers the Python script:
// Only trigger on operator's own messages
client.on('message_create', msg => {
if (msg.fromMe && msg.body.includes("|")) {
exec(`python "cancel_class.py" "${msg.body}"`,
(error, stdout) => console.log(stdout));
}
});
The Python script parses the message, queries the course database, and sends the email:
# Parse WhatsApp message
course, date, status = [x.strip() for x in message.split("|")]
# Lookup course in Excel database
df = pd.read_excel("courses.xlsx")
row = df[df["Course Code"] == course]
# Handle multiple email aliases per course
alias_list = [x.strip() for x in row["Alias"].values[0].split(",")]
recipients = alias_list + [""]
# Send via Microsoft SMTP
server = smtplib.SMTP("smtp.office365.com", 587)
server.starttls()
server.login("", PASSWORD)
server.sendmail(SENDER, recipients, msg.as_string())
The msg.fromMe filter is the key security design โ the bot ignores 100% of incoming WhatsApp messages from faculty, students, groups, and all other contacts. Only messages sent by the operator trigger the automation.
Several courses at IIT Patna serve multiple student cohorts simultaneously. For example, CDA 101 (Mathematics-I) is taken by both CSDA and AICS students โ requiring notification to two separate email groups from a single cancellation command.
The system handles this automatically by parsing comma-separated aliases from the Excel database and sending to all of them in a single email operation:
CDA 101 | Mathematics-I |
A single WhatsApp message notifies both student groups, the CC recipient, and creates one unified log entry โ with zero additional effort.
The system has a clear upgrade path that will make it even more capable:
cancel CDA 101 will auto-fill today's date, removing the need for date entryThis project demonstrates that operational automation doesn't require a dedicated engineering team โ it requires identifying the right problem, choosing the right tools, and building something that actually gets used.