Generate Employee Retention Analytics Reports with GPT-4o and Gmail Digests

Go to Workflow
0 views
Built by Rahul Joshi Rahul Joshi
Created on June 09, 2026

Description

Description
This workflow automates employee retention analytics by combining candidate performance data with trait-level retention statistics. It scores candidates, validates data, and generates a polished Retention Digest HTML email using GPT (Azure OpenAI). Hiring managers receive structured insights weekly, highlighting top/weak traits, candidate scores, and actionable JD refinement tips.

What This Template Does (Step-by-Step)
โšก Manual Trigger โ€“ Starts workflow execution on demand.
๐Ÿ“‘ Candidate Data Fetch (Google Sheets โ€“ Hires Tracking) โ€“ Pulls candidate-level details like name, role, traits, start date, and retention status.
๐Ÿ“‘ Trait Summary Fetch (Google Sheets โ€“ Retention Summary) โ€“ Fetches aggregated trait-level retention statistics, including hires, stayed, left, retention %, and weight adjustments.
๐Ÿ”€ Merge Candidate + Trait Data โ€“ Combines both datasets into a unified stream for scoring.
๐Ÿงฎ Candidate Scoring & Data Normalization (Code Node) โ€“
Cleans and standardizes data.
Builds a trait โ†’ weight map.
Calculates each candidateโ€™s Candidate_Score.
Outputs normalized JSON.
โœ… Data Validation (If Node) โ€“ Ensures both candidate and trait datasets are present.
TRUE โ†’ continues to AI digest generation.
FALSE โ†’ routes to error logging.
โš ๏ธ Error Handling Logic (Google Sheets โ€“ Error Log) โ€“ Logs any failed or incomplete runs into a dedicated error sheet for auditing.
๐Ÿง  AI Processing Backend (Azure OpenAI) โ€“ Prepares candidate + trait data for GPT processing.
๐Ÿค– Retention Digest Generator (LLM Chain) โ€“ Uses GPT (gpt-4o-mini) to create a structured HTML Retention Digest, including:
TL;DR summary
Top Traits (positive retention)
Weak Traits (negative retention)
Candidate highlights (scores & retention status)
3 actionable JD refinement tips
๐Ÿ“ง Email Delivery (Gmail) โ€“ Sends the digest directly to hiring managers as a styled HTML email with subject:
Retention Analysis Digest โ€“ Weekly Update

Prerequisites
Google Sheets (Hires Tracking + Retention Summary + Error Log)
Gmail API credentials
Azure OpenAI access (gpt-4o-mini model)
n8n instance (self-hosted or cloud)

Key Benefits
โœ… Automates retention analytics & reporting
โœ… Provides AI-powered insights in structured HTML
โœ… Improves hiring strategy with trait-based scoring
โœ… Reduces manual effort in weekly retention reviews
โœ… Ensures reliability with error handling & validation

Perfect For
HR & Recruitment teams monitoring post-hire retention
Organizations optimizing job descriptions & hiring strategy
Talent analytics teams needing automated, AI-driven insights
Stakeholders requiring clear weekly digest emails

Nodes Used (5)

Azure OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatAzureOpenAi
Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Sheets
n8n-nodes-base.googleSheets