Back to Alchemy
Alchemy RecipeIntermediateautomation

SaaS customer churn analysis and retention email campaign automation

Churn is the silent profit killer for SaaS companies. A customer who was engaged three months ago suddenly stops logging in, and by the time you notice, they're already half-way through cancelling their subscription. The problem is clear: most product teams lack a systematic way to identify at-risk customers in real time and respond with targeted, personalised retention messages before they leave. The traditional approach requires manual work. A data analyst runs a query, exports a CSV, someone reads through the results, marketing writes a generic email, and a few days later, customers receive a message that feels impersonal. By then, it's too late. The customers who needed to hear from you most have already made their decision. What if you could identify churn risk automatically, generate highly personalised retention emails for each at-risk customer, and deliver those emails within hours? This Alchemy workflow automates the entire process, from data analysis through personalised outreach, with no manual handoffs. For more on this, see Real estate market analysis report from listing data.

The Automated Workflow

This workflow combines three core capabilities: churn detection using Deepnote, personalised email generation via ColdConvert AI, and optional voice follow-ups through ElevenLabs. We'll orchestrate everything with n8n, which offers excellent control over complex multi-step processes without leaving your infrastructure. The flow works like this: 1. A scheduled trigger runs a churn detection query in Deepnote 2. Deepnote identifies at-risk customers and returns a JSON list 3. n8n receives that list and loops through each customer 4. For each customer, ColdConvert AI generates a personalised retention email 5. The email is sent via your existing email provider (SendGrid, Mailgun, or equivalent) 6. Optionally, ElevenLabs creates a voice message for high-value accounts 7. All activity is logged back to your database for tracking and analysis

Setting up the orchestration layer in n8n:

First, create a new workflow in n8n. Add a Cron trigger that runs daily at 06:00 UTC (or whatever time you prefer). This will kick off your entire churn detection and outreach process automatically.

Cron: 0 6 * * *
Timezone: UTC

Next, add a Webhook node to receive data from Deepnote. When Deepnote completes its analysis, it will POST a JSON payload here containing a list of at-risk customers.

POST /webhook/churn-detection
Content-Type: application/json { "customers": [ { "id": "cust_12345", "email": "alice@example.com", "name": "Alice Chen", "company": "Acme Corp", "churn_risk_score": 0.87, "days_since_login": 28, "mrr": 500, "primary_use_case": "project management" }, { "id": "cust_12346", "email": "bob@example.com", "name": "Bob Williams", "company": "TechStart Ltd", "churn_risk_score": 0.92, "days_since_login": 35, "mrr": 1200, "primary_use_case": "team collaboration" } ]
}

In Deepnote, you'll write a Python script that queries your product database and identifies at-risk customers. Here's a simplified example using SQL:

python
import requests
import json
from datetime import datetime, timedelta # Connect to your database
query = """
SELECT user_id as id, email, full_name as name, company_name as company, CASE WHEN days_since_last_login > 30 THEN 0.9 WHEN days_since_last_login > 20 THEN 0.7 WHEN feature_usage_decline > 0.5 THEN 0.8 ELSE 0.3 END as churn_risk_score, days_since_last_login, monthly_recurring_revenue as mrr, primary_feature as primary_use_case
FROM users
WHERE status = 'active' AND days_since_last_login > 14 AND monthly_recurring_revenue > 100
ORDER BY churn_risk_score DESC
LIMIT 100
""" # Execute query and collect results
results = execute_query(query) # Send to n8n webhook
payload = { "customers": [dict(row) for row in results]
} webhook_url = "https://your-n8n-instance.com/webhook/churn-detection"
requests.post(webhook_url, json=payload)

Back in n8n, add a Loop node to iterate through each customer. For each iteration, you'll call ColdConvert AI's email generation endpoint. ColdConvert AI accepts a request with customer context and generates a personalised retention email. The API endpoint is:

POST https://api.coldconvert.ai/v1/generate-email
Content-Type: application/json
Authorization: Bearer YOUR_COLDCONVERT_API_KEY { "recipient_name": "Alice Chen", "company_name": "Acme Corp", "context": "You haven't used our project management features in 28 days. We want to help you get the most from your account.", "tone": "friendly and concerned", "call_to_action": "Book a 15-minute check-in call", "signature": "Your Product Team"
}

ColdConvert will return something like:

json
{ "subject": "We've missed you, Alice – let's get Acme back on track", "body": "Hi Alice,\n\nWe noticed you haven't logged into your project management dashboard in about a month. That caught our attention, because we know Acme was using the feature heavily before.\n\nOften when usage drops off, it's because something isn't working the way teams need it to. Rather than assume, we wanted to reach out directly.\n\nWould you have 15 minutes this week for a quick call? We'd love to understand what changed and see if we can help.\n\nBest,\nYour Product Team", "email_id": "email_abc123"
}

In n8n, map the customer data into the ColdConvert API request. After receiving the generated email, send it via your email provider. If you use SendGrid, the node configuration looks like this:

POST https://api.sendgrid.com/v3/mail/send
Authorization: Bearer YOUR_SENDGRID_API_KEY { "personalizations": [ { "to": [ { "email": "alice@example.com", "name": "Alice Chen" } ], "subject": "We've missed you, Alice – let's get Acme back on track" } ], "from": { "email": "support@yourcompany.com", "name": "Your Product Team" }, "content": [ { "type": "text/html", "value": "<html><body><!-- Email body from ColdConvert --></body></html>" } ], "reply_to": { "email": "support@yourcompany.com" }
}

For high-value customers (MRR above a threshold you set), optionally trigger a voice message. Use ElevenLabs to convert the email message to speech:

POST https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM
Authorization: xi-api-key: YOUR_ELEVENLABS_API_KEY
Content-Type: application/json { "text": "Hi Alice, we noticed you haven't used our platform in a few weeks. We'd love to understand what's happening and see if we can help. Give us a call, or reply to this email.", "voice_settings": { "stability": 0.5, "similarity_boost": 0.75 }
}

This returns an audio file you can attach to a follow-up email or store for manual outreach by your customer success team. Finally, log all activity back to your database. Create a simple audit table that tracks which customers were flagged, which emails were sent, when they were sent, and whether the customer re-engaged within the next 7 days. This data helps you refine your churn detection logic over time.

INSERT INTO churn_outreach_log ( customer_id, email_sent_at, email_subject, email_body_preview, churn_risk_score, mrr, voice_message_sent
) VALUES (...)

The Manual Alternative

If n8n feels like overkill, you can run this process semi-automatically using Zapier. Set up a schedule in Zapier to trigger your Deepnote query daily, then use Zapier's built-in email template features to create basic retention messages. This requires more manual review of which customers to contact, but it takes less infrastructure setup. Alternatively, run Deepnote on a schedule, export the results to a shared Google Sheet, and have your customer success manager use ColdConvert AI's web interface to generate emails one at a time. This approach is slower but gives you full editorial control before any email is sent.

Pro Tips

Rate limiting:

ColdConvert AI enforces a 100-email-per-hour limit on the Hobby plan.

If you have more than 100 at-risk customers per day, either upgrade the plan or split the workflow across multiple scheduled runs throughout the day.

Error handling:

Add retry logic to your n8n workflow. If the ColdConvert API times out, wait 30 seconds and try again. If it fails three times, log the customer ID to a separate "failed" queue for manual review.

Cost optimisation:

Only send voice messages to customers with MRR above £500. For the rest, stick to email. This keeps your ElevenLabs costs reasonable whilst still reaching your most valuable accounts with high-touch outreach.

Segmentation:

Don't send the same retention message to everyone. Use customer properties (company size, feature usage, time as customer) to branch your workflow. A customer who's been with you for three years needs a different message than someone in their first month.

Testing:

Before running this workflow at scale, test it on a small cohort (10-20 customers). Check that the generated emails don't contain hallucinations, that they actually address the customer's specific situation, and that the tone matches your brand. Adjust the ColdConvert prompt until you're satisfied.

Cost Breakdown

ToolPlan NeededMonthly CostNotes
DeepnoteFree or Pro£0–£29Free tier sufficient for most churn queries; upgrade only if you need advanced hardware
n8nCloud or Self-Hosted£20–£120Starter plan covers 100,000 executions/month; most workflows use 50–200 executions/day
ColdConvert AIHobby or Pro£40–£200Hobby plan: 100 emails/hour; Pro: 500 emails/hour and priority support
SendGridFree or Pay-As-You-Go£0–£40Free up to 100 emails/day; standard rates thereafter
ElevenLabsStarter or Pro£11–£99Starter: 10,000 characters/month; Pro: 100,000 characters/month
TotalMid-range£70–£300Covers 100–500 at-risk customers per month