Global AI Network

B2B SaaS Churn Risk Analysis and Management AI Agent

Automatically identify at-risk customers by analyzing engagement across HubSpot, Salesforce, Pipedrive, and Zendesk, then alert your team via Slack, email, and task boards before renewals expire.

18+
Total Deployments
5 min
Setup Time
v1.0
Version

Need Help Getting Started? Our AI Specialists Will Set It Up For Free

1-Click Deployment 5-Min Setup Free Expert Support
Technology Partners

Required Integrations

This agent works seamlessly with these platforms to deliver powerful automation.

Gmail

Gmail

Send, receive, and manage Gmail messages with full email automation capabilities

Jira

Jira

Issue tracking and project management software for agile development teams

PostgreSQL

PostgreSQL

Connect to PostgreSQL databases to query and manage data

Slack

Slack

Send messages, manage channels, and automate workflows in Slack workspaces

Trello

Trello

Visual project management with boards, lists, and cards for organizing tasks and...

Zendesk

Zendesk

Customer service and support platform with ticket management, user administratio...

Step by Step

Setup Tutorial

mission-briefing.md

What This Agent Does

The Churn Guardian Agent is your proactive early-warning system for customer retention. This intelligent workflow automatically monitors accounts with upcoming subscription renewals (30 days out), analyzes engagement data from multiple sources, calculates churn risk scores, and triggers appropriate alerts and actions based on risk levels. Instead of manually checking multiple platforms and spreadsheets, your Customer Success team receives prioritized, actionable insights delivered directly to their inbox and project management tools.

Key benefits include:

  • Saves 15-20 hours per week by automating data collection across 5+ platforms
  • Reduces churn by 25-40% through early intervention on high-risk accounts
  • Eliminates manual scoring with AI-powered risk assessment
  • Ensures no account falls through the cracks with automated daily monitoring
  • Provides complete audit trail with PostgreSQL logging of all assessments

Perfect for: SaaS companies with subscription models, Customer Success teams managing 50+ accounts, businesses using multiple CRM/support platforms, and organizations looking to implement data-driven retention strategies.

Who Is It For

This workflow is designed for:

  • Customer Success Managers who need early warning signals for at-risk renewals
  • Account Management Teams managing B2B SaaS subscriptions with 30-90 day renewal cycles
  • Revenue Operations Leaders seeking to reduce churn through predictive analytics
  • CS Operations Managers who want to standardize risk assessment across their team
  • Startup to Mid-Market SaaS Companies (50-500 customers) where manual monitoring becomes unsustainable

You'll get the most value if you're currently using multiple tools (CRM, support desk, analytics) and struggling to get a unified view of account health before renewals.

Required Integrations

PostgreSQL

Why it's needed: Stores your subscription data, tracks renewal dates, and logs all churn assessments for historical analysis and reporting.

Setup steps:

  1. Ensure you have a PostgreSQL database (version 10 or higher recommended)
  2. Create a subscriptions table with columns: account_id, account_name, renewal_date, mrr, contract_value
  3. Create a churn_logs table with columns: account_id, assessment_date, churn_score, risk_level, engagement_data (JSONB)
  4. Note your database host, port, database name, username, and password

Configuration in TaskAGI:

  1. Navigate to IntegrationsAdd IntegrationPostgreSQL
  2. Enter connection details: Host, Port (default: 5432), Database name
  3. Provide credentials with SELECT and INSERT permissions
  4. Click Test Connection to verify
  5. Save with a memorable name like "Production DB - Subscriptions"

Zendesk

Why it's needed: Retrieves support ticket volume and sentiment to gauge customer satisfaction and engagement levels.

Setup steps:

  1. Log into your Zendesk admin panel
  2. Go to AdminAPIZendesk API
  3. Enable Token Access
  4. Generate a new API token and copy it immediately
  5. Note your Zendesk subdomain (e.g., yourcompany.zendesk.com)

Configuration in TaskAGI:

  1. Go to IntegrationsAdd IntegrationZendesk
  2. Enter your subdomain (without .zendesk.com)
  3. Provide your Zendesk email address
  4. Paste the API token
  5. Test the connection and save as "Zendesk Support"

Trello

Why it's needed: Creates visual task cards for medium and high-risk accounts, enabling your CS team to track intervention efforts.

Setup steps:

  1. Log into Trello and navigate to the board where you want cards created
  2. Note the Board ID (visible in the URL when viewing the board)
  3. Visit https://trello.com/app-key to get your API Key
  4. Click the token link to generate an API Token with read/write permissions
  5. Identify or create lists for "High Risk Renewals" and "Medium Risk Renewals"

Configuration in TaskAGI:

  1. Navigate to IntegrationsAdd IntegrationTrello
  2. Enter your API Key and Token
  3. Test the connection
  4. Save as "Trello - CS Board"
  5. In the workflow nodes, you'll specify Board ID and List IDs

Jira

Why it's needed: Creates formal issues for high-risk accounts requiring cross-functional intervention (product, engineering, leadership).

Setup steps:

  1. Access your Jira instance as an administrator
  2. Create a project for Customer Success (or identify existing project key, e.g., "CS")
  3. Go to ProfileAccount SettingsSecurityAPI Tokens
  4. Click Create API Token, name it "TaskAGI Integration"
  5. Copy the token immediately (it won't be shown again)
  6. Note your Jira domain (e.g., yourcompany.atlassian.net)

Configuration in TaskAGI:

  1. Go to IntegrationsAdd IntegrationJira
  2. Enter your Jira site URL
  3. Provide your email address
  4. Paste the API token
  5. Test and save as "Jira - Customer Success"

Slack

Why it's needed: Sends real-time alerts to your CS team channel when high-risk accounts are detected, enabling immediate action.

Setup steps:

  1. Go to https://api.slack.com/apps and click Create New App
  2. Choose From scratch, name it "Churn Guardian"
  3. Select your workspace
  4. Navigate to OAuth & Permissions
  5. Add the chat:write scope under Bot Token Scopes
  6. Click Install to Workspace and authorize
  7. Copy the Bot User OAuth Token (starts with xoxb-)
  8. Invite the bot to your CS team channel: /invite @Churn Guardian

Configuration in TaskAGI:

  1. Navigate to IntegrationsAdd IntegrationSlack
  2. Paste the Bot User OAuth Token
  3. Test the connection
  4. Save as "Slack - CS Alerts"

Gmail

Why it's needed: Sends detailed email notifications to CS team members and daily summary reports to leadership.

Setup steps:

  1. Create a dedicated Google account for automation (e.g., automation@yourcompany.com) or use an existing service account
  2. Enable 2-factor authentication on the account
  3. Visit https://myaccount.google.com/apppasswords
  4. Generate an App Password for "Mail" on "Other device"
  5. Copy the 16-character password (remove spaces)

Configuration in TaskAGI:

  1. Go to IntegrationsAdd IntegrationGmail
  2. Enter the full Gmail address
  3. Paste the App Password (not your regular password)
  4. Test by sending a test email
  5. Save as "Gmail - CS Notifications"

Note: Update the email addresses in nodes 3744, 3747, 3748, and 3753 to match your team's addresses (csm-team@yourcompany.com and success-team@yourcompany.com).

Configuration Steps

Step 1: Configure the Daily Trigger (Node 3726)

Set when the workflow runs each day:

  • Schedule Type: Daily
  • Time: 09:00 (9 AM in your timezone - adjust to start of your workday)
  • Timezone: Select your company's primary timezone
  • Days: Monday through Friday (uncheck weekends unless you have weekend coverage)

This ensures fresh assessments are ready when your team starts their day.

Step 2: Initialize Configuration & Thresholds (Node 3727)

Define the scoring thresholds that determine risk levels:

{
  "days_until_renewal": 30,
  "high_risk_threshold": 70,
  "medium_risk_threshold": 40,
  "engagement_weights": {
    "hubspot_score": 0.25,
    "salesforce_health": 0.20,
    "pipedrive_activity": 0.15,
    "zendesk_tickets": 0.20,
    "feature_usage": 0.20
  }
}

Adjust these values based on your business:

  • high_risk_threshold: Scores above this trigger urgent alerts (default: 70)
  • medium_risk_threshold: Scores above this trigger moderate alerts (default: 40)
  • engagement_weights: Adjust importance of each data source (must sum to 1.0)

Step 3: Fetch Subscriptions Expiring in J+30 (Node 3728)

Configure the PostgreSQL query to identify accounts for assessment:

Query:

SELECT 
  account_id,
  account_name,
  renewal_date,
  mrr,
  contract_value,
  csm_owner
FROM subscriptions
WHERE renewal_date = CURRENT_DATE + INTERVAL '30 days'
  AND status = 'active'
ORDER BY contract_value DESC

Customize:

  • Change 30 days to match your preferred lead time (e.g., 45 days for enterprise accounts)
  • Add AND tier = 'enterprise' to focus on high-value segments
  • Adjust ORDER BY to prioritize differently (e.g., by mrr DESC)

Step 4: Process Subscriptions Loop (Node 3729)

This loop processes each account individually. No configuration needed - it automatically iterates through results from Step 3.

The loop exposes these variables for subsequent nodes:

  • {{nodes.3729.account_id}} - Unique account identifier
  • {{nodes.3729.account_name}} - Company name
  • {{nodes.3729.renewal_date}} - Subscription renewal date
  • {{nodes.3729.mrr}} - Monthly recurring revenue
  • {{nodes.3729.contract_value}} - Total contract value

Step 5-9: Data Collection Nodes

These nodes run in parallel to gather engagement data:

HubSpot - Get Engagement (Node 3730):

  • Endpoint: https://api.hubapi.com/crm/v3/objects/companies/{{nodes.3729.account_id}}
  • Method: GET
  • Headers: Authorization: Bearer YOUR_HUBSPOT_API_KEY
  • Extract: Engagement score, last contact date, email open rates

Salesforce - Get Account (Node 3731):

  • Endpoint: https://yourinstance.salesforce.com/services/data/v57.0/sobjects/Account/{{nodes.3729.account_id}}
  • Method: GET
  • Authentication: OAuth 2.0 (configure in Salesforce integration)
  • Extract: Health score, NPS, executive sponsor engagement

Pipedrive - Get Deal Activities (Node 3732):

  • Endpoint: https://api.pipedrive.com/v1/deals/{{nodes.3729.account_id}}/activities
  • Method: GET
  • Query Parameters: api_token=YOUR_PIPEDRIVE_TOKEN&start_date={{30_days_ago}}
  • Extract: Number of activities, last activity date, activity types

Zendesk - Get Organization Tickets (Node 3733):

  • Organization ID: {{nodes.3729.account_id}}
  • Date Range: Last 30 days
  • Status Filter: All (to capture both open and recently resolved)
  • Extract: Ticket count, average resolution time, satisfaction ratings

Analytics API - Feature Usage (Node 3734):

  • Endpoint: https://analytics.yourcompany.com/api/usage
  • Method: POST
  • Body:
{
  "account_id": "{{nodes.3729.account_id}}",
  "date_range": "last_30_days",
  "metrics": ["dau", "mau", "feature_adoption", "session_duration"]
}
  • Extract: Daily active users, feature adoption rate, login frequency

Step 10: Data Merge (Node 3735)

Combines all collected data into a unified object. Configuration:

  • Merge Strategy: Deep merge
  • Handle Missing: Use null for missing values
  • Output Format:
{
  "account_info": "{{nodes.3729}}",
  "hubspot": "{{nodes.3730}}",
  "salesforce": "{{nodes.3731}}",
  "pipedrive": "{{nodes.3732}}",
  "zendesk": "{{nodes.3733}}",
  "analytics": "{{nodes.3734}}"
}

Step 11-12: AI Scoring

Scoring API Call (Node 3736):

  • Endpoint: Your AI scoring service (e.g., OpenAI, custom ML model)
  • Prompt Template:
Analyze this customer data and predict churn risk (0-100):
- Engagement: {{nodes.3735.hubspot.engagement_score}}
- Support tickets: {{nodes.3735.zendesk.ticket_count}}
- Feature usage: {{nodes.3735.analytics.mau}}
- Last contact: {{nodes.3735.salesforce.last_contact}}

Return JSON: {"churn_score": X, "reasoning": "..."}

Engagement API Call (Node 3737): Similar to above, but focuses on engagement quality and recommendations.

Step 13-14: Score Computation

Normalize Scoring Response (Node 3738): Ensures consistent data structure from AI responses.

Compute Churn Score (Node 3739): JavaScript function that combines AI scores with rule-based logic:

const aiScore = nodes[3738].churn_score;
const ticketCount = nodes[3735].zendesk.ticket_count;
const usage = nodes[3735].analytics.mau;

let finalScore = aiScore;

// Penalty for high ticket volume
if (ticketCount > 10) finalScore += 15;

// Penalty for low usage
if (usage < 5) finalScore += 20;

// Cap at 100
finalScore = Math.min(finalScore, 100);

return {
  churn_score: finalScore,
  risk_level: finalScore > 70 ? 'HIGH' : finalScore > 40 ? 'MEDIUM' : 'LOW',
  factors: {
    ai_score: aiScore,
    ticket_penalty: ticketCount > 10,
    usage_penalty: usage < 5
  }
};

Step 15-23: Risk-Based Actions

The workflow branches based on churn score:

HIGH Risk Path (Score > 70):

  1. Check HIGH Risk (Node 3740): Condition: {{nodes.3739.risk_level}} == 'HIGH'

  2. Trello Card (Node 3741):

    • Board ID: Your Trello board ID
    • List ID: "High Risk Renewals" list ID
    • Card Name: 🚨 HIGH RISK: {{nodes.3729.account_name}} - Renewal {{nodes.3729.renewal_date}}
    • Description: Include churn score, key factors, and recommended actions
    • Labels: "high-risk", "urgent"
    • Due Date: 7 days before renewal
  3. Jira Issue (Node 3742):

    • Project Key: CS (or your project)
    • Issue Type: Task
    • Summary: HIGH CHURN RISK: {{nodes.3729.account_name}} (${{nodes.3729.contract_value}})
    • Priority: Highest
    • Description: Detailed analysis with data from all sources
    • Assignee: CSM owner from database
  4. Slack Alert (Node 3743):

    • Channel: #customer-success-alerts
    • Message:
🚨 *HIGH CHURN RISK DETECTED*
*Account:* {{nodes.3729.account_name}}
*Churn Score:* {{nodes.3739.churn_score}}/100
*Contract Value:* ${{nodes.3729.contract_value}}
*Renewal Date:* {{nodes.3729.renewal_date}}

*Key Issues: