← All N8N workflows
AI & researchChain LLMFilterGmailGoogle SheetsIf

Example Customer Data

Configured with Chain LLM, Filter, Gmail, Google Sheets, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
TriggerScheduled Start: DailyChurn CheckSchedule TriggerData storeFetch Customer Datafrom SheetGoogle SheetsRoutingFilter High Churn Risk& No Campaign CustomersFilterRoutingCheck if EligibleCustomers FoundIfRoutingProcess Each EligibleCustomerLoop Over ItemsAI & modelsGenerate Win-Back OfferChain LLMAI & models(LLM Model for OfferGeneration)LM Chat Google GeminiTransform(Parse Offer JSON)Output Parser StructuredData storeLog Sent Offer inSystem LogGoogle SheetsMessagingSend Win-Back Offer viaEmailGmailTransformSet 'Not Found' StatusEdit FieldsData storeLog 'Not Found' inSystem LogGoogle Sheets

Node categories in this workflow

  • Trigger
  • Data store
  • Routing
  • AI & models
  • Transform
  • Messaging

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Scheduled Start: Daily Churn CheckTriggerSchedule TriggerSee node parameters
Fetch Customer Data from SheetData storeGoogle SheetsSee node parameters
Filter High Churn Risk & No Campaign CustomersRoutingFilterSee node parameters
Check if Eligible Customers FoundRoutingIfSee node parameters
Process Each Eligible CustomerRoutingLoop Over ItemsSee node parameters
Generate Win-Back OfferAI & modelsChain LLMSee node parameters
(LLM Model for Offer Generation)AI & modelsLM Chat Google GeminiSee node parameters
(Parse Offer JSON)TransformOutput Parser StructuredSee node parameters
Log Sent Offer in System LogData storeGoogle SheetsappendOrUpdate
Send Win-Back Offer via EmailMessagingGmailSee node parameters
Set 'Not Found' StatusTransformEdit FieldsSee node parameters
Log 'Not Found' in System LogData storeGoogle SheetsappendOrUpdate

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • gmailOAuth2
  • googlePalmApi
  • googleSheetsOAuth2Api

Workflow notes

00. Daily Start & Fetch Customer Data

00. Daily Start & Fetch Customer Data

Purpose: Automatically triggers the workflow once daily based on the schedule set in the first node. It then fetches all customer data from the specified Google Sheet ('Customer Data' sheet) to identify potential churn risks for the day.

03. Handle No Eligible Customers

03. Handle No Eligible Customers

Purpose: This path executes if the initial filter finds no customers meeting the win-back criteria during the daily check.

  1. Set Status: Sets a variable indicating no eligible customers were found (system_log = NOT_FOUND).
  2. Log Status: Records this 'NOT_FOUND' status along with the current timestamp in the 'SYSTEM_LOG' Google Sheet. This helps track when the daily workflow ran but had no one to process.
01. Filter & Branch

01. Filter & Branch

Purpose: Filters the fetched customer data to identify those meeting specific win-back criteria:

  1. predicted_churn_score is greater than 0.7.
  2. No previous campaign date exists (created_campaign_date is empty - Note: Verify this field's purpose or adjust logic if needed). Then, it checks if any customers passed the filter. The workflow branches based on whether eligible customers were found.
02. Generate & Send Win-Back Offer (Loop)

02. Generate & Send Win-Back Offer (Loop)

Purpose: Processes each eligible customer found in the previous step individually within a loop.

  1. Generate Offer (Gemini): Uses Google Gemini to create a personalized win-back offer (Informational, Bonus Points, or Discount) based on the customer's predicted_churn_score and preferred_categories. Outputs offer details in JSON format.
  2. Log Sent Offer: Records the successful generation and intent to send the offer (action_taken, timestamp, customer_id) in the 'SYSTEM_LOG' Google Sheet.
  3. Send Email (Gmail): Sends the generated offer details (offer_title and offer_details) via email to the customer's user_mail. The loop continues until all eligible customers are processed.
Example Customer Data

Example Customer Data

{ "customer_id": "CUST_001", "last_purchase_date": "2024-01-10T10:00:00Z", "purchase_frequency_days": 90, "user_mail":"user@example.com", "days_since_last_purchase": 110, "total_spent_usd": 55.0, "preferred_categories": ["Kitap", "Ofis Malzemeleri"], "predicted_churn_score": 0.85, "profile_tags": ["inactive_long_time", "low_spender"], "timestamp": "2024-06-08T09:00:00Z" }

Example Customer Data

Example Customer Data

Purpose and structure

This folder contains the Example Customer Data workflow. Its executable nodes use chainLlm, filter, gmail, googleSheets, if, lmChatGoogleGemini, outputParserStructured, scheduleTrigger, set, splitInBatches. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Scheduled Start: Daily Churn Check

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Filter/0948_Filter_Schedule_Create_Scheduled.json MIT; preserve source notices.

More in AI & research