# Score customer health and churn risk with Salesforce: n8n workflow

> Started by a clock, and works across Gmail and Salesforce. It hands the judgement calls to Gemini.

Source: https://millionrounds.com/workflow/score-customer-health-and-churn-risk-with-salesforce (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [CRM](https://millionrounds.com/workflows?category=CRM#library)

# Score customer health and churn risk with Salesforce

Started by a clock, and works across Gmail and Salesforce. It hands the judgement calls to Gemini. 27 steps, 4 branches, 2 loops or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fscore-customer-health-and-churn-risk-with-salesforce)

**27 steps** Large: read it before trusting it with anything live

**4** Branches: places the flow splits

**2** Loops or waits

**2** Services it connects to

## The flow

Starts it 2 Model 1 Logic 14 Service 10

The steps in the order they run, from what starts it.

- 1 **Batch Sync** Schedule trigger *Starts it*
- 2 **Error Trigger** Error trigger *Starts it*
- 3 **Salesforce - Fetch Accounts** Salesforce *Service*
- 4 **Alert - Error Notification** Gmail *Service*
- 5 **Loop Over Items** Split In Batches *Logic*
- 6 **Init Retry Code** Code *Logic*
- 7 **Decision - Circuit Breaker** If *Logic*
- 8 **ERP - Fetch Orders** Http Request *Service*
- 9 **Fallback - Fetch Orders Backup** Http Request *Service*
- 10 **Decision - Orders Success** If *Logic*
- 11 **ERP - Fetch Payments** Http Request *Service*
- 12 **Wait - Retry Delay** Wait *Logic*
- 13 **Support - Fetch Tickets** Http Request *Service*
- 14 **Increment Retry Count** Code *Logic*
- 15 **Marketing - Fetch Engagement** Http Request *Service*
- 16 **Normalize - Customer Data** Set *Logic*
- 17 **Prepare AI Input** Code *Logic*
- 18 **AI - Customer Intelligence (Gemini)** Google Gemini *Model*
- 19 **Parse - AI Output** Code *Logic*
- 20 **Decision - High Risk** If *Logic*
- 21 **Alert - High Risk Email** Gmail *Service*
- 22 **Routing - Customer Type** Switch *Logic*
- 23 **Merge - Preserve Data** Merge *Logic*
- 24 **Update an account** Salesforce *Service*
- 25 **Merge - Final Output** Merge *Logic*
- 26 **Log - Execution Summary** Code *Logic*
- 27 **Alert - Success Notification** Gmail *Service*

## How it's built

- **Starts on:** A clock
- **Steps:** 27, with 4 branches, 2 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Salesforce
- **Model:** Gemini

## Questions

What does it need to run?

An n8n account, plus your own Gmail and Salesforce accounts, and a key for Gemini. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

Does it use AI?

Yes. It calls Gemini. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 27 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 27 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fscore-customer-health-and-churn-risk-with-salesforce)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Salesforce](https://millionrounds.com/workflows?service=Salesforce#library)

## Workflows like it

Also crm, with the same services where possible, closest in size first.

- [**Restaurant daily insights with Gemini** 27 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/restaurant-daily-insights-with-gemini)
- [**LoneScale - Tracking contacts' job changes to Salesforce** 26 steps · Salesforce, Slack](https://millionrounds.com/workflow/lonescale-tracking-contacts-job-changes-to-salesforce)
- [**Automate sales for digital products & SaaS with OpenAI** 29 steps · calls a model · Gmail](https://millionrounds.com/workflow/automate-sales-for-digital-products-and-saas-with-openai)
- [**Creator sponsorship and brand deals CRM with OpenAI and Gmail** 29 steps · calls a model · Gmail, Notion](https://millionrounds.com/workflow/creator-sponsorship-and-brand-deals-crm-with-openai-and-gmai)
- [**Email follow up system with OpenAI and Gmail** 25 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/email-follow-up-system-with-openai-and-gmail)
- [**LinkedIn auto-connect & personalized messaging for sales** 29 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/linkedin-auto-connect-and-personalized-messaging-for-sales)
