🤝 Predict supplier churn and generate retention plans with Notion, Slack, and Groq

⚡ 16 views · 🤝 CRM & Sales Operations

Description

Quick overview

This workflow runs weekly to pull supplier activity from Notion, engineer churn-risk features, and use Groq-hosted LLM prompts to classify supplier churn risk and generate retention plans. It updates each supplier record in Notion and posts a Slack alert only when a supplier is rated High risk.

How it works

  1. Runs every week on a schedule.
  2. Retrieves all supplier records from a Notion database.
  3. Calculates behavioral risk features such as PO trend, engagement score, and delivery/financial/contract-risk flags from the Notion fields.
  4. Processes suppliers one at a time and sends the features to a Groq LLM to return structured JSON with churn risk level, risk score, confidence, and key drivers.
  5. Sends the churn assessment to a second Groq LLM prompt to generate a structured retention plan with priority, recommended actions, suggested owner, and summary.
  6. If the supplier’s churn risk is High, posts a formatted alert with drivers and recommended actions to a Slack channel.
  7. Updates the supplier’s Notion page with the churn risk, risk score, key drivers, retention plan, and a “Last Evaluated” timestamp, then continues to the next supplier.

Setup

  1. Connect your Notion credentials and set the correct database ID, ensuring each page contains the fields referenced (PO counts, RFQ response rate, contract expiry days, delivery/quality/payment/dispute metrics, and the output fields like Churn Risk and Risk Score).
  2. Add a Groq API credential (used as the language model for both AI prompts) and confirm the selected model is available in your Groq account.
  3. Add a Slack OAuth2 credential and select the target channel for High-risk alerts.
  4. Review the schedule timing (weekly, Monday at 09:00) and adjust it to match your monitoring cadence.
  5. (Optional) Tune the risk thresholds and scoring logic in the feature-engineering code and the AI prompt instructions to fit your procurement definitions.

Additional info

How To Customize Nodes

Add‑ons

Use Case Examples

Troubleshooting Guide

IssuePossible CauseSolution
Workflow fails at Code nodeMissing numeric data in Notion.Ensure all numeric fields in Notion have a value (even if it’s 0) to avoid “null” errors.
AI Output is garbledPrompt/Parser mismatch.Verify the Parse Churn Prediction Output schema matches the JSON format requested in the prompt.
Slack alerts not sendingIF-Node routing.Check if the supplier is actually being classified as “High” risk; otherwise, the alert is skipped by design.
Notion Update failsProperty names don’t match.Double-check that your Notion property names (e.g., “Churn Risk”) match the keys in the Update node exactly.
Rate Limit ErrorsToo many suppliers at once.Increase the time in the Rate Limit (Wait) node to give the Groq API more room to breathe.

Need Help?

Building a predictive supply chain requires precision. If you need assistance mapping your specific procurement data to this workflow, or if you want to extend this system with custom AI prompts and ERP integrations, our n8n workflow developers are ready to assist.

đź”— Nodes Used

Slack, Notion, Basic LLM Chain, Structured Output Parser, Groq Chat Model

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup