Quick Overview
This workflow collects safety inspection submissions via an n8n form, uses DeepSeek (OpenAI API) to turn non-pass results into corrective actions, logs everything to Google Sheets, and sends critical alerts, overdue reminders, and a weekly digest via Telegram and Gmail.
How it works
- Receives a safety inspection submission from an n8n form with statuses and notes for four safety areas.
- Validates that required fields are present, and if anything is missing sends an invalid-submission alert to Telegram and Gmail.
- Normalizes the inspection data and sends the findings to DeepSeek (via the OpenAI API) to generate structured corrective actions for any area not marked Pass.
- Parses and validates the AI output, calculates due dates and severity counts, and builds a critical-findings list when applicable.
- Appends the inspection summary to the Inspections tab in Google Sheets and appends each corrective action to the CorrectiveActions tab.
- If any critical findings exist, sends an immediate critical alert to Telegram and an email report via Gmail.
- Runs daily to detect overdue open corrective actions in Google Sheets and sends overdue reminders to Telegram and Gmail when any are found.
- Runs weekly to compute inspection/action stats from Google Sheets, uses DeepSeek to draft a short digest, and sends the digest to Telegram and Gmail.
Setup
- Add credentials for Google Sheets, OpenAI API (used with the DeepSeek model), Gmail OAuth2, and Telegram.
- Create or select a Google Sheets spreadsheet with Inspections and CorrectiveActions tabs (and ensure the columns match the fields this workflow appends).
- Update the Google Sheets document ID, Gmail recipient address, and Telegram chat ID to match your environment.
- Share the n8n form URL from the Safety Inspection Form trigger with inspectors and adjust the form fields/inspection areas and AI prompts if your checklist differs.
- Confirm the schedule times (daily 07:00 and Mondays 09:00 in the Asia/Jakarta timezone) fit your reporting cadence.