Weekly at-risk customer outreach drafts for your CSM team

Every Monday at 8am, find your paying customers who are quietly disengaging, draft personalized re-engagement emails in Gmail, and queue HubSpot tasks for your CSMs.

Agentic Task
PostgreSQLGmailHubSpotCustomer SupportSalesEmail AutomationAI ReportsNotifications & Alerts

Build me a weekly at-risk customer outreach agent that runs on a cron every Monday at 8am in our local timezone.

Step 1: PostgreSQL Custom Query. Pull our active paying customers and the signals that indicate they are disengaging. The rough query should select organizations (or accounts) where subscription_status = 'active' and the customer matches at least one of these at-risk conditions: last_login_at is older than 21 days; weekly_active_sessions over the last 7 days have dropped more than 50% versus the 4-week trailing baseline; or feature_usage_count is trending down week-over-week. Return account id, account name, MRR or contract value, primary contact email, primary contact name, the specific at-risk signal(s) that matched, the actual numbers behind those signals (e.g. days since last login, current vs baseline sessions), and the HubSpot contact id if we store it. Sort by contract value descending. Treat the schema as a placeholder the user will adapt to their actual table and column names.

Step 2: Pick the top 10 most valuable at-risk accounts from the result set. If fewer than 10 qualify, just take what you have. Skip any account with no primary contact email.

Step 3: For each of the top 10 accounts, decide which signal is the most compelling thing to reference (the one most likely to feel relevant to the customer, not the most alarming to us). Then write a short, personalized re-engagement email, 4 to 6 sentences, addressed to the primary contact by first name, that references the specific signal in plain language ('I noticed your team hasn't logged in in a few weeks' rather than 'last_login_at > 21 days'), offers help, and proposes a low-friction next step like a 15-minute call. Subject line should be specific and not feel like a template.

Step 4: For each email, use Gmail Create a Draft so the email lands in the CSM's Drafts folder, not sent. Set the To, Subject, and body. Do not send. The point is the CSM reviews and decides whether to send.

Step 5: For each of the same 10 accounts, use HubSpot Create Task to create a follow-up task on the matching HubSpot contact. Subject should be 'Review at-risk outreach: <Account name>', due date today, priority HIGH if the account is in the top 3 by value, MEDIUM otherwise. Associate the task to the HubSpot contact id from step 1 (and to the company if available). In the task body include a one-line summary of the at-risk signal and a link to the Gmail draft if accessible.

The judgment of which signal matters most for which account, and how to phrase the outreach so it feels like a person noticed and not like a churn-prevention sequence, is the reason this is an agent and not a static code workflow. Keep the writing warm, specific, and human.

Inputs to expose: the cron schedule, the SQL query (so the user can adapt table/column names), the at-risk thresholds (absence days, session drop percentage), the number of accounts to surface, the from-address for Gmail, the HubSpot owner id for the tasks, and the tone of the outreach.

Additional information

What does this prompt do?
  • Pulls active, paying customers from your product database and looks for early churn signals like long absences, dropping session counts, and feature usage trending down.
  • Ranks the top 10 most valuable at-risk accounts so your CSMs spend the week on the customers who actually matter.
  • Writes a short, personalized re-engagement email for each account that names the exact signal it spotted and lands as a Gmail draft, ready for your CSM to review and send.
  • Files a follow-up task on the matching HubSpot contact so the account shows up in the CSM's task queue, not just their inbox.
What do I need to use this?
  • A PostgreSQL database where customer activity is tracked (last login, sessions, feature usage, subscription status).
  • A Gmail account for the CSM who should own the drafts.
  • A HubSpot account with the customers already in it as contacts so tasks can be attached to the right record.
How can I customize it?
  • Change the schedule. Monday 8am is the default, but you can run it every two weeks or on Friday afternoons instead.
  • Tune the at-risk signals. Adjust the absence window, the session drop threshold, or what counts as a paying customer based on how your product is used.
  • Change how many accounts are picked, who the drafts are addressed from, and what tone the outreach takes (warm check-in, value reminder, direct ask for a call).

Frequently asked questions

Does it send the emails automatically?
No. The agent only creates Gmail drafts so your CSM stays in control. Nothing goes out until a person reviews and clicks send.
What does an at-risk customer actually look like to this agent?
By default it looks for active, paying customers whose last login is over three weeks old, whose weekly sessions have dropped more than 50% versus their four-week baseline, or whose feature usage is trending down. You can change any of those thresholds.
We use Snowflake or BigQuery, not Postgres. Will this still work?
This template is wired to PostgreSQL. If your product data lives in a different warehouse, swap the database step for that source and the rest of the workflow stays the same.
What if a customer is already in an active conversation with a CSM?
You can add a rule to exclude accounts with an open HubSpot task or a recent email so you do not double up on outreach.
Why agent instead of a fixed script?
The judgment calls of which signal to lean on and how to phrase the email for that specific account are exactly where an agent earns its keep. A script would send everyone the same template.

Stop losing paying customers to silence.

Connect your product database, Gmail, and HubSpot once, and your CSMs walk in every Monday with the right 10 conversations already drafted.