Automation library · Alerts and monitoring

Match teacher substitutes and send notifications with OpenAI

Started by someone submitting a form, and works across Gmail, Google Calendar, Google Sheets, Slack and two others. It hands the judgement calls to OpenAI. 29 steps, 2 branches: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

29 stepsLarge: read it before trusting it with anything live
2Branches: places the flow splits
0Loops or waits
6Services it connects to

The flow

Starts it 3Model 1Logic 8Service 17

The steps in the order they run, from what starts it.

  1. 1Receive Teacher Leave RequestForm triggerStarts it
  2. 2Weekly Schedule Trigger (Mondays 8am)Schedule triggerStarts it
  3. 3On Workflow ErrorError triggerStarts it
  4. 4Fetch Full Timetable from SheetsGoogle SheetsService
  5. 5Fetch Substitute AvailabilityGoogle SheetsService
  6. 6Fetch Today's Assigned SubstitutesGoogle SheetsService
  7. 7Read Payroll Sheet for DigestGoogle SheetsService
  8. 8Slack, Send Workflow Error AlertSlackService
  9. 9Telegram, Send Workflow Error AlertTelegramService
  10. 10Filter Classes for Absent TeacherCodeLogic
  11. 11Aggregate Substitute WorkloadCodeLogic
  12. 12Build AI Substitute Ranking PromptCodeLogic
  13. 13Slack, Send Weekly Workload DigestSlackService
  14. 14AI Rank Substitute CandidatesOpen AiModel
  15. 15Parse Ranked CandidatesCodeLogic
  16. 16Pick Next Available CandidateCodeLogic
  17. 17IF: Candidate Available?IfLogic
  18. 18Telegram, Confirm With SubstituteTelegramService
  19. 19Telegram, Escalate to AdminTelegramService
  20. 20IF: Substitute Accepted?IfLogic
  21. 21Email Assigned Substitute TeacherGmailService
  22. 22Log Decline & Increment AttemptCodeLogic
  23. 23Twilio, SMS Backup to SubstituteTwilioService
  24. 24Google Calendar, Block Substitute TimeGoogle CalendarService
  25. 25Notify Students of Class ChangeGmailService
  26. 26Send Admin Telegram SummaryTelegramService
  27. 27Mark Class as Covered in TimetableGoogle SheetsService
  28. 28Log Substitute Hours to Payroll SheetGoogle SheetsService
  29. 29Append to Audit LogGoogle SheetsService

How it's built

Starts on
Someone submitting a form
Steps
29, with 2 branches
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Google Calendar, Google Sheets, Slack, Telegram, Twilio
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Calendar, Google Sheets, Slack, Telegram and Twilio accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone submitting a form.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 29 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 29 steps before you point it at anything that matters.