Quick Overview
This workflow collects pool service visit notes via an n8n Form, looks up customer and history in Google Sheets, uses Google Gemini to structure the notes into a report, logs visits and work orders back to Sheets, and sends alerts via Gmail, Slack, and Telegram.
How it works
- Receives a pool service visit submission from an n8n Form with customer ID, technician notes, and optional water readings.
- Looks up the customer in Google Sheets and sends a Telegram alert if the customer ID is unknown.
- Pulls the customer’s recent visit history from Google Sheets and combines it with the new readings to generate rule-based flags for out-of-range chemistry and high filter pressure.
- Sends the combined context to Google Gemini to extract structured fields (condition, issues, actions, follow-up, summaries) and validates the response against a strict JSON schema.
- Builds a visit record with an HTML customer report, calculates urgency, priority, and next visit date, and appends the visit to the Google Sheets Visits table (or logs a manual-review record and posts a Slack alert if the AI step fails).
- If follow-up is needed, creates a work order in the Google Sheets Work Orders table and updates the customer record with the latest status and next visit date.
- If the visit is urgent, posts an operations alert to Slack, and if the report needs manager approval it emails an approve/hold link via Gmail and waits for the decision before either sending the customer report email or marking it as held.
- Runs every morning (Mon–Sat) to pull open work orders from Google Sheets, builds a daily digest, and sends it to Telegram.
Setup
- Create a Google Sheets spreadsheet with Customers, Visits, and Work Orders sheets (and matching column names used by this workflow), then add a Google Service Account credential with access to the spreadsheet and update the document ID if needed.
- Add a Google Gemini (Google PaLM) API credential and keep the model set to
models/gemini-3.1-flash-lite (or update it consistently across the workflow).
- Add a Gmail OAuth2 credential, set the manager approval recipient email, and ensure the sender name and customer email field mapping match your business requirements.
- Add Slack and Telegram credentials, then replace
YOUR_TELEGRAM_CHAT_ID and select the correct Slack channel for urgent alerts and AI-failure notifications.
- Edit the configuration constants in the code steps (company name/phone/brand color, chemistry thresholds, PSI limits, plan intervals, and Sunday skipping) to match your operating standards.