Quick Overview
This workflow receives churn requests via webhook, uses OpenAI (DeepSeek) plus Airtable customer data to generate a retention offer and draft email, notifies the team for high-risk cases via Telegram, logs cases to Airtable, and sends a monthly churn report by Gmail and Telegram.
How it works
- Receives a POST webhook request with customer cancellation details and normalizes fields like case ID, email, plan, MRR, and reason.
- Validates that the request includes a customer email and cancellation reason, then alerts via Telegram and emails the team via Gmail if required fields are missing.
- For valid requests, an OpenAI (DeepSeek) agent looks up the customer in Airtable and returns a JSON decision with risk level, recommended offer, and a drafted retention email.
- Parses the agent’s JSON output and creates a new record for the churn case in an Airtable “Churn Cases” table.
- If the case is high risk or requires human review, posts a detailed alert to Telegram and then emails the customer the drafted save offer via Gmail; otherwise it sends the standard save offer email directly.
- On a monthly schedule, fetches open churn cases from Airtable, summarizes counts and at-risk MRR, uses OpenAI (DeepSeek) to write narrative highlights, then sends the report via Gmail and posts it to Telegram.
Setup
- Create Airtable tables named “Customers” and “Churn Cases”, then update the Airtable base ID/table names as needed and connect an Airtable personal access token.
- Add an OpenAI API credential and confirm the DeepSeek model selection used for both the retention agent and the monthly report.
- Connect your Gmail OAuth2 credential and update the recipient addresses and email subject/body text for invalid-request notifications, save-offer emails, and monthly reports.
- Connect a Telegram bot credential and set the target chat ID for invalid-request alerts, high-value alerts, and monthly report posts.
- Copy the webhook URL for the POST /churn/save endpoint and configure your app/form/billing system to send churn events with at least customer_email and reason (optionally plan and mrr).