Skip to main content

Automated daily customer win-back campaign with AI offers

Workflow preview

Workflow preview
100%
Automated daily customer win-back campaign with AI offers preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Proactively retain customers predicted to churn with this automated n8n workflow. Running daily, it identifies high risk customers from your Google Sheet, uses Google Gemini to generate personalize...

Best for

  • Social Media automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.googlesheets, n8n-nodes-base.filter, n8n-nodes-base.if, n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.chainllm, @n8n/n8n-nodes-langchain.lmchatgooglegemini, @n8n/n8n-nodes-langchain.outputparserstructured

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Onur.

Original n8n.io source

1.1 Workflow description

Title
Automated daily customer win-back campaign with AI offers
Workflow name
Automated daily customer win-back campaign with AI offers

Proactively retain customers predicted to churn with this automated n8n workflow. Running daily, it identifies high-risk customers from your Google Sheet, uses Google Gemini to generate personalized win-back offers based on their churn score and preferences, sends these offers via Gmail, and logs all actions for tracking.

What does this workflow do?

This workflow automates the critical process of customer retention by:

  • Running automatically every day on a schedule you define.
  • Fetching customer data from a designated Google Sheet containing metrics like predicted churn scores and preferred categories.
  • Filtering to identify customers with a high churn risk (score > 0.7) who haven't recently received a specific campaign (based on the created_campaign_date field - you might need to adjust this logic).
  • Using Google Gemini AI to dynamically generate one of three types of win-back offers, personalized based on the customer's specific churn score and preferred product categories:
    • Informational: (Score 0.7-0.8) Highlights new items in preferred categories.
    • Bonus Points: (Score 0.8-0.9) Offers points for purchases in a target category (e.g., Books).
    • Discount Percentage: (Score 0.9-1.0) Offers a percentage discount in a target category (e.g., Books).
  • Sending the personalized offer directly to the customer via Gmail.
  • Logging each sent offer or the absence of eligible customers for the day in a separate 'SYSTEM_LOG' Google Sheet for monitoring and analysis.

Who is this for?

  • CRM Managers & Retention Specialists: Automate personalized outreach to at-risk customers.
  • Marketing Teams: Implement data-driven retention campaigns with minimal manual effort.
  • E-commerce Businesses & Subscription Services: Proactively reduce churn and increase customer lifetime value.
  • Anyone using customer data (especially churn prediction scores) who wants to automate personalized retention efforts via email.

Benefits

  • Automated Retention: Set it up once, and it runs daily to engage at-risk customers automatically.
  • AI-Powered Personalization: Go beyond generic offers; tailor messages based on churn risk and customer preferences using Gemini.
  • Proactive Churn Reduction: Intervene before customers leave by addressing high churn scores with relevant offers.
  • Scalability: Handle personalized outreach for many customers without manual intervention.
  • Improved Customer Loyalty: Show customers you value them with relevant, timely offers.
  • Action Logging: Keep track of which customers received offers and when the workflow ran.

How it Works

  1. Daily Trigger: The workflow starts automatically based on the schedule set (e.g., daily at 9 AM).
  2. Fetch Data: Reads all customer data from your 'Customer Data' Google Sheet.
  3. Filter Customers: Selects customers where predicted_churn_score > 0.7 AND created_campaign_date is empty (verify this condition fits your needs).
  4. Check for Eligibility: Determines if any customers passed the filter.
  5. IF Eligible Customers Found:
    • Loop: Processes each eligible customer one by one.
    • Generate Offer (Gemini): Sends the customer's predicted_churn_score and preferred_categories to Gemini. Gemini analyzes these and the defined rules to create the appropriate offer type, value, title, and detailed message, returning it as structured JSON.
    • Log Sent Offer: Records action_taken = SENT_WINBACK_OFFER, the timestamp, and customer_id in the 'SYSTEM_LOG' sheet.
    • Send Email: Uses the Gmail node to send an email to the customer's user_mail with the generated offer_title as the subject and offer_details as the body.
  6. IF No Eligible Customers Found:
    • Set Status: Creates a record indicating system_log = NOT_FOUND.
    • Log Status: Records this 'NOT_FOUND' status and the current timestamp in the 'SYSTEM_LOG' sheet.

n8n Nodes Used

  • Schedule Trigger
  • Google Sheets (x3 - Read Customers, Log Sent Offer, Log Not Found)
  • Filter
  • If
  • SplitInBatches (Used for Looping)
  • Langchain Chain - LLM (Gemini Offer Generation)
  • Langchain Chat Model - Google Gemini
  • Langchain Output Parser - Structured
  • Set (Prepare 'Not Found' Log)
  • Gmail (Send Offer Email)

Prerequisites

  • Active n8n instance (Cloud or Self-Hosted).
  • Google Account with access to Google Sheets and Gmail.
  • Google Sheets API Credentials (OAuth2): Configured in n8n.
  • Two Google Sheets:
    • 'Customer Data' Sheet: Must contain columns like customer_id, predicted_churn_score (numeric), preferred_categories (string, e.g., ["Books", "Electronics"]), user_mail (string), and potentially created_campaign_date (date/string).
    • 'SYSTEM_LOG' Sheet: Should have columns like system_log (string), date (string/timestamp), and customer_id (string, optional for 'NOT_FOUND' logs).
  • Google Cloud Project with the Vertex AI API enabled.
  • Google Gemini API Credentials: Configured in n8n (usually via Google Vertex AI credentials).
  • Gmail API Credentials (OAuth2): Configured in n8n with permission to send emails.

Setup

  1. Import the workflow JSON into your n8n instance.
  2. Configure Schedule Trigger: Set the desired daily run time (e.g., Hours set to 9).
  3. Configure Google Sheets Nodes:
    • Select your Google Sheets OAuth2 credentials for all three Google Sheets nodes.
    • 1. Fetch Customer Data...: Enter your 'Customer Data' Spreadsheet ID and Sheet Name.
    • 5b. Log Sent Offer...: Enter your 'SYSTEM_LOG' Spreadsheet ID and Sheet Name. Verify column mapping.
    • 3b. Log 'Not Found'...: Enter your 'SYSTEM_LOG' Spreadsheet ID and Sheet Name. Verify column mapping.
  4. Configure Filter Node (2. Filter High Churn Risk...):
    • Crucially, review the second condition: {{ $json.created_campaign_date.isEmpty() }}. Ensure this field and logic correctly identify customers who should receive the offer based on your campaign strategy. Modify or remove if necessary.
  5. Configure Google Gemini Nodes: Select your configured Google Vertex AI / Gemini credentials in the Google Gemini Chat Model node. Review the prompt in the 5a. Generate Win-Back Offer... node to ensure the offer logic matches your business rules (especially category names like "Books").
  6. Configure Gmail Node (5c. Send Win-Back Offer...): Select your Gmail OAuth2 credentials.
  7. Activate the workflow.
  8. Ensure your 'Customer Data' and 'SYSTEM_LOG' Google Sheets are correctly set up and populated. The workflow will run automatically at the next scheduled time.

This workflow provides a powerful, automated way to engage customers showing signs of churn, using personalized AI-driven offers to encourage them to stay. Adapt the filtering and offer logic to perfectly match your business needs!

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Scheduled Start: Daily Churn Check

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - Fetch Customer Data from Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 3 - Filter High Churn Risk & No Campaign Customers

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 4 - Check if Eligible Customers Found

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 5 - Process Each Eligible Customer

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 6 - Generate Win-Back Offer

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 7 - (LLM Model for Offer Generation)

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 8 - (Parse Offer JSON)

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 9 - Log Sent Offer in System Log

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 10 - Send Win-Back Offer via Email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 11 - Set 'Not Found' Status

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Log 'Not Found' in System Log

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 13 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Automated daily customer win-back campaign with AI offers
Complexity advanced
Nodes 17
Categories Social Media, Multimodal AI
Author Onur
Published 12 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4001/4001.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated daily customer win-back campaign with AI offers do?

Proactively retain customers predicted to churn with this automated n8n workflow. Running daily, it identifies high risk customers from your Google Sheet, uses Google Gemini to generate personalize...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Social Media, Multimodal AI use case.