WhatsApp School-Enquiry Agent
An AI agent that answers school leaders with their own school data
An agent on the official WhatsApp Cloud API that answers questions on central-exam schedules, Nafs results, school analytics and comparisons with the office, department and national levels — no database: a file index plus PHP tools compute every number, and the model only phrases the answer.
Mathematics — Grade 6
Proficiency: 41.2%
+3.1 pts above the office average
Rank in office: 12 of 58 (79th percentile)10:41
vs 31.0% across the department.
Suggest prioritising it in the remedial plan.10:43
Week 8 — Sunday, second period.
Source: central-exams circular10:45
- 3,453
- Schools indexed
- 77K+
- Nafs result rows
- 8
- Agent tools
- ~2s
- Response time
The department receives thousands of repetitive enquiries; sending huge spreadsheets (77K Nafs rows alone) to a language model is technically infeasible, costly and yields unreliable figures.
An indexer reads each file once, building a JSON file per school, comparison distributions and a BM25 document index; the model calls the right tool and receives a computed number. Each question costs a few thousand tokens and is answered in about two seconds.
Architecture: PHP computes, the model only phrases
- data/ folderExcel · Word · PDF
- IndexerReads each file once
- File indexJSON per school · comparison distributions · BM25
- WhatsAppCloud API
- webhook.phpSignature & session check
- DeepSeekChooses a tool
- PHP toolsComputed from the school file
- ReplyIn about two seconds
Key capabilities
School authentication
Statistical code + principal mobile; every tool is scoped to the signed-in school
8 model tools
School card, query, aggregate, compare with region, trend over time, document search…
Drop-in knowledge folder
Any Excel, Word or PDF is added and indexed (absence, behaviour, circulars…)
Broadcast circulars
Approved template messages to all school leaders with opt-out
Leadership access
Special code allowing leaders to query any school
Rank & percentile
School rank and percentile at office, department and national levels
Figures are computed deterministically from source — never by the model; access is scoped per school and the index keeps the source of every number: data-quality and data-minimisation principles in practice.