Predict Customer Churn Risk using HubSpot, Google Sheets, and AI Agents - n8n Workflow

Use this powerful n8n workflow to analyze customer health scores from HubSpot and Google Sheets data. This n8n automation leverages AI agents to detect churn risk and automatically send alerts.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Customer Success Managers (CSMs) who need proactive churn alerts.
Sales Operations teams looking to integrate AI-driven customer intelligence.
Technical users seeking advanced examples of n8n templates utilizing AI Agents and custom tools.
Developers needing a complex, multi-step n8n node integration blueprint.

Overview

Retaining customers requires timely intervention based on hard data. This sophisticated n8n workflow addresses the challenge of siloed data by unifying information from HubSpot CRM (deals, tickets) and Google Sheets (product usage metrics). The core value proposition of this n8n automation lies in its use of advanced AI techniques (LangChain Agents and Chains) to not just collect data, but to analyze it against predefined churn thresholds (deal age, sentiment score, feature usage decline). The result is a high-value, actionable email alert sent automatically, allowing CSMs to engage at the precise moment risk becomes critical. This is a prime example of complex, data-driven orchestration possible within an n8n workflow.

How it Works

This powerful n8n workflow operates in two main segments: the main churn analysis flow and a sub-workflow dedicated to ticket sentiment scoring.


  1. Main Churn Analysis Flow: The process begins with the Manual Trigger: Run Churn Analysis n8n trigger (designed for periodic execution). It first pulls all relevant deals using the HubSpot: Get All Deals n8n node and enters a loop via the Start Loop: For Each Deal node.

  2. AI Data Aggregation: For each deal, the AI Agent: Gather Customer Data n8n node activates. This agent orchestrates several tools to collect necessary inputs:

It fetches deal details, contact info, and associated support tickets from HubSpot.
It calls a separate webhook (Tool: Calculate Sentiment Score) to analyze all current tickets.
* It retrieves detailed feature usage data from Google Sheets.

  1. Sentiment Scoring (Sub-Workflow): When the agent calls the webhook, the Trigger: Receive Tickets for Scoring n8n trigger activates the scoring sub-workflow. Tickets are formatted, analyzed using the AI: Analyze Ticket Sentiment n8n node, scored, summed, and the resulting total sentiment score is returned to the main agent flow.

  2. Churn Risk Assessment: Once the AI Agent has all structured data, the AI Chain: Analyze for Churn Risk n8n node takes over. This critical n8n node uses a detailed prompt, informed by deal age, sentiment score, and feature usage trends, to generate a professional alert email draft only if the defined churn thresholds are crossed.

  3. Alerting: The email draft is structured, converted to HTML, and finally sent using the Email: Send Churn Alert n8n node, ensuring the right team member receives a proactive alert regarding the potential customer churn risk. This advanced use of the n8n trigger and subsequent nodes makes for an incredibly valuable automation.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n workflow JSON: In your n8n instance, click 'New' > 'Import from JSON' and paste the provided code.

  2. Configure Credentials: Set up credentials for the following n8n node actions:

HubSpot: Get All Deals (OAuth 2).
Email: Send Churn Alert (SMTP).
Ensure your LLM provider (like OpenAI, used in the Config: Set LLM for Agent & Chains n8n node) is configured.

  1. Sub-Workflow Setup (Sentiment Scoring): Identify the webhook URL for the Trigger: Receive Tickets for Scoring n8n trigger. You must paste this URL into the Tool: Calculate Sentiment Score HTTP Request n8n node in the main workflow.

  2. Tool Configuration:

In the Tool: Get Feature Usage from Sheets n8n node, update the Google Sheet Document ID to point to your product usage data.
* Verify the endpoint configuration for the Tool: Get HubSpot Data n8n node (This tool appears to rely on a separate MCP HubSpot data service endpoint).

  1. Review AI Prompts: Adjust the parameters in the AI Chain: Analyze for Churn Risk n8n node to match your specific churn definition (e.g., scoring thresholds, deal age requirements).

  2. Activate: Save both the main workflow and the sentiment scoring sub-workflow, then activate the main n8n workflow.

Node Details

Manual Trigger: Run Churn Analysis: The initial n8n trigger used to manually test the workflow or configured to run on a set schedule.
HubSpot: Get All Deals: Fetches all customer deals from HubSpot, providing the starting list for the subsequent loop.
AI Agent: Gather Customer Data (Agent n8n node): An advanced LangChain n8n node that acts as an orchestrator. It uses multiple tools (HubSpot Data, Google Sheets, Sentiment Score Webhook) to gather diverse data points about a single customer, proving the power of a combined n8n workflow setup.
Tool: Calculate Sentiment Score (HTTP Request Tool): This n8n node calls the sub-workflow's webhook to offload the intensive task of analyzing all support tickets for sentiment.
AI: Analyze Ticket Sentiment (LangChain n8n node): Part of the sub-workflow, this node analyzes the text content of each ticket to determine if the sentiment is Positive, Neutral, or Negative.
AI Chain: Analyze for Churn Risk (Chain n8n node): The core intelligence n8n node. It evaluates the consolidated data (deal info, score, usage trends) against predefined thresholds, determining if an alert email should be generated.


  • Email: Send Churn Alert (EmailSend n8n node): The final action in the n8n workflow, responsible for sending the structured, AI-generated alert email to the Customer Success team.

Related n8n Workflows

Free

Nodes: 20 Nodes
Updated: December 26 2025
View all
Created by

We create bespoke AI solutions, automations and agents that help your business as it scales.

Featured*