Downloads
Download the n8n workflow (JSON)
whatsapp-leave-requests-n8n.json · n8n workflow · 20 steps · starts with WhatsApp Trigger · uses WhatsApp, Google Sheets, Anthropic, Slack, Google Calendar · 34 KB
Import into n8n: Create Workflow, then the menu, then Import from File.
How to import it into n8n
- In n8n, create a new workflow.
- Open the ⋯ menu at the top right and choose Import from File, then pick the downloaded .json. (Or open the file, copy everything and paste it on the canvas.)
- Open each node with a warning and connect your own account: the file carries no passwords or keys.
- Run it once with Test workflow, check the result, then switch it to Active.
What this workflow does
Your staff already ask for leave on WhatsApp. This workflow makes those messages count. A staff member sends "12 se 14 Nov leave chahiye" to the business number. Claude reads the type, dates and reason. A Code node counts working days, checks their balance and looks for anyone in the same team already off. The manager gets one Slack message with everything and taps Approve or Reject. Approved leave goes on the team calendar, the balance drops in the sheet, and the staff member gets a WhatsApp reply with what is left.
Who it is for
Shops, clinics, restaurants, factories and offices with 10 to 100 staff, where leave is asked in chats and tracked in a register or someone's memory.
What you need
- An n8n account (Cloud or self-hosted)
- A WhatsApp Business Cloud API number that staff can message
- An Anthropic API key for Claude
- A Google Sheet with Staff and Leave tabs
- Slack for the manager, and a shared Google Calendar for the team
The workflow, step by step
Step 1 · Staff just WhatsApp the number
WhatsApp Trigger receives every message. Clean up message keeps the phone, name, text and message id. Skip repeats stops Meta's retries from running twice. Find staff member looks up the phone in the Staff tab and Known staff? continues only for staff with a text message, so customers on the same number are not affected.
Step 2 · Claude reads "12 se 14 Nov"
Read the leave request gives Claude today's date and the message, at temperature 0. Leave fields forces the answer into kind, leave type, from date, to date, half day, reason and confidence. Leave or balance? sends leave requests on, balance questions to an instant reply, and anything else to the manager.
Step 3 · Balance and clashes checked
Get approved leave reads approved rows from the Leave tab. Check balance and clashes counts working days (Sundays skipped), reads the right balance column, finds anyone in the same team whose leave overlaps, and adds warnings like past dates or not enough balance.
Step 4 · Manager approves in one tap
Ask manager on Slack sends name, role, type, dates, days, reason, balance before and after, clashes, warnings and the original message, with Approve and Reject. Approved? splits the answer.
Step 5 · Calendar, sheet and reply, done
On Approve, Add to team calendar adds an all-day event and Update leave balance reduces the right column in Staff. Both answers go through Log leave, which writes the request to Leave as Approved or Rejected. Reply to staff sends the result on WhatsApp; if it fails, Reply failed alert tells the manager in Slack. Balance questions go to Reply with balance, and unclear messages to Pass to manager.
Setup
- Import the JSON into n8n.
- Create the Sheet:
Staff(Phone, Name, Role, Team, Casual left, Sick left, Earned left) andLeave(Request ID, Phone, Name, Team, Type, From, To, Days, Status, Decided). Phones as 9198XXXXXXXX. - Connect WhatsApp on the trigger and both send nodes, plus Google Sheets, Anthropic, Slack and Google Calendar.
- Pick the Slack channel and paste your team calendar ID in Add to team calendar.
- From a staff phone, send "kal leave chahiye, fever hai". Check the Slack message, approve it, and check the calendar, sheet and WhatsApp reply.
How to customise
- Different weekly off: change
d.weekday !== 7in Check balance and clashes (6 is Saturday). - Holidays: add a
Holidaystab and skip those dates in the same loop. - Manager per team: add a Manager Slack ID column to
Staffand use it as the Slack channel. - Cancellations: add a Switch output for
cancelthat finds the request inLeaveand gives the days back.
Guardrails
- The bot never approves leave. Every request needs the manager's tap.
- Only numbers in your Staff sheet are processed.
- Days and balances are calculated by code, not by AI.
Troubleshooting
- Nothing happens: the phone in
Staffmust match WhatsApp's format exactly (country code, no + or spaces). - Wrong dates: check the n8n timezone is Asia/Kolkata (it is set in the workflow settings).
- Reply fails the next day: WhatsApp free-text replies need the staff message to be under 24 hours old. Approve sooner, or switch Reply to staff to an approved template.
- Calendar event one day short: all-day events end on the day after; the workflow already adds one day.
Want the members-only resources too?
A free account unlocks them all, including the ones shared in DMs.

