Match teacher substitutes and send notifications with GPT-4o-mini, Google Sheets, Gmail and Telegram
Quick overview This workflow captures teacher leave requests via an n8n form, pulls timetable and substitute availability from Google Sheets, uses OpenAI to pick the best substitute, then notifies the substitute, students, and an admin (Gmail and Telegram) and logs coverage and payroll back to Google Sheets.
How it works Receives a teacher leave request from an n8n form with the teacher name, email, leave date, and reason. Fetches the full timetable and the substitute availability pool from Google Sheets. Filters the timetable down to the absent teacherβs classes on the requested leave date and creates one item per affected class. Builds a structured prompt per class and sends it to OpenAI (gpt-4o-mini) to select the best substitute based on subject fit, availability, and weekly hours. Parses the OpenAI JSON response to extract the chosen substitute, match reason, and confidence. Emails the assigned substitute and notifies the affected students via Gmail, while also sending an assignment summary to an admin via Telegram. Updates the timetable in Google Sheets to mark the class as covered and appends a payroll log entry for the substitute.
Setup Add Google Sheets credentials and replace YOUR_SPREADSHEET_ID and YOUR_TIMETABLE_SHEET_ID with your actual spreadsheet ID(s), ensuring the Timetable, Substitutes, and SubstitutePayroll sheets and column names match the workflow. Add a Gmail OAuth2 credential for sending emails to substitutes and students. Add an OpenAI credential/API key and ensure the selected model (gpt-4o-mini) is available in your OpenAI account. Add a Telegram bot credential and replace YOUR_ADMIN_TELEGRAM_CHAT_ID with the admin chat ID to receive summaries. Add a Slack OAuth2 credential and set the target channel for error alerts triggered by the workflow error handler.
Related Templates
Transform Gmail Newsletters into Insightful LinkedIn Posts Using OpenAI
Who Is This For? This workflow is perfect for content creators, marketers, and business professionals who receive regu...
Compare Lists and Identify Common Items & Differences Using Custom Keys
This workflow compares two lists of objects (List A and List B) using a user-specified key (e.g. email, id, domain) and ...
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments