Skip to main content

Monitor customer risk and AI feedback using PostgreSQL, Gmail and Discord

Workflow preview

Workflow preview
100%
Monitor customer risk and AI feedback using PostgreSQL, Gmail and Discord preview
Open on n8n.io

Important notice

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

1. Workflow Overview

How it works This workflow monitors customer health by combining payment behavior, complaint signals, and AI driven feedback analysis. It runs on daily and weekly schedules to evaluate risk levels,...

Best for

  • Market Research automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googlesheets, n8n-nodes-base.httprequest, n8n-nodes-base.code, n8n-nodes-base.gmail, n8n-nodes-base.splitinbatches, n8n-nodes-base.merge, n8n-nodes-base.wait, n8n-nodes-base.scheduletrigger

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Monitor customer risk and AI feedback using PostgreSQL, Gmail and Discord
Workflow name
Monitor customer risk and AI feedback using PostgreSQL, Gmail and Discord

How it works

This workflow monitors customer health by combining payment behavior, complaint signals, and AI-driven feedback analysis. It runs on daily and weekly schedules to evaluate risk levels, escalate high-risk customers, and generate structured product insights. High-risk cases are notified instantly, while detailed feedback and audit logs are stored for long-term analysis.

Step-by-step

  • Step 1: Triggers & mode selection

    • Daily Risk Check Trigger – Starts the workflow on a daily schedule.
    • Weekly schedule1 – Triggers the workflow for weekly summary runs.
    • Edit Fields3 – Sets flags for daily execution.
    • Edit Fields2 – Sets flags for weekly execution.
    • Switch1 – Routes execution based on daily or weekly mode.
  • Step 2: Risk evaluation & escalation

    • Fetch Customer Risk Data – Pulls customer, payment, product, and complaint data from PostgreSQL.
    • Is High Risk Customer? – Evaluates payment status and complaint count.
    • Prepare Escalation Summary For Low Risk User – Assigns low-risk status and no-action details.
    • Prepare Escalation Summary For High Risk User – Assigns high-risk status and escalation actions.
    • Merge Risk Result – Combines low-risk and high-risk customer records.
    • Send a message4 – Sends the customer risk summary via Gmail.
    • Send a message5 – Sends the same risk summary to Discord.
    • Code in JavaScript3 – Appends notification status and timestamps.
    • Append or update row in sheet3 – Logs risk evaluations and notification status in Google Sheets.
  • Step 3: AI feedback & reporting

    • Get row(s) in sheet1 – Fetches customer records for feedback analysis.
    • Loop Over Items1 – Processes customers one by one.
    • Prompt For Model1 – Builds a structured prompt for product feedback analysis.
    • HTTP Request1 – Sends data to the AI model for insight generation.
    • Code in JavaScript – Merges AI feedback with original customer data.
    • Append or update row in sheet – Stores AI-generated feedback in Google Sheets.
    • Wait1 – Controls execution pacing between records.
    • Merge1 – Prepares consolidated feedback data.
    • Send a message1 – Emails the final AI-powered feedback report.

Why use this?

  • Detect customer churn risk early using payment and complaint signals
  • Automatically escalate high-risk customers without manual monitoring
  • Convert raw customer issues into executive-ready product insights
  • Keep a complete audit trail of risk, feedback, and notifications
  • Align support, product, and leadership teams with shared visibility

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 - Get row(s) in sheet1

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

Block 2 - HTTP Request1

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 3 - Prompt For Model1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Send a message1

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

Block 5 - Loop Over Items1

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

Block 6 - Merge1

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 7 - Wait1

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 8 - Code in JavaScript

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Append or update row in sheet

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

Block 10 - Weekly schedule1

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

Block 11 - Edit Fields2

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

Block 12 - Switch1

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

Block 13 - Edit Fields3

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

Block 14 - Fetch Customer Risk Data

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 15 - Is High Risk Customer?

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

Block 16 - Send a message4

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

Block 17 - Merge Risk Result

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 18 - Prepare Escalation Summary For Low Risk User

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

Block 19 - Prepare Escalation Summary For High Risk User

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

Block 20 - Code in JavaScript3

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 21 - Append or update row in sheet3

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

Block 22 - Send a message5

Type / Role
n8n-nodes-base.discord - discord
Config choices
Version 2

Block 23 - Sticky Note3

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

Block 24 - Daily Risk Check Trigger

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

Showing the first 24 of 27 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Monitor customer risk and AI feedback using PostgreSQL, Gmail and Discord
Complexity advanced
Nodes 27
Categories Market Research, AI Summarization
Author Avkash Kakdiya
Published 29 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/12254/12254.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 Monitor customer risk and AI feedback using PostgreSQL, Gmail and Discord do?

How it works This workflow monitors customer health by combining payment behavior, complaint signals, and AI driven feedback analysis. It runs on daily and weekly schedules to evaluate risk levels,...

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 Market Research, AI Summarization use case.