---
ref: workflow:at-risk-customer-rescue
title: Spot and recover at-risk customer accounts
author: thedogwiththedataonit
tools: [tool:mixpanel/run-query, tool:stripe/list-customers, tool:stripe/list-subscriptions, tool:slack/post-message, tool:brew/generate-email]
tags: [capability:route-alerts, capability:track-product-usage, capability:track-revenue, capability:write-copy, channel:chat, channel:email, has:mcp, motion:midbound]
updated: 2026-09-27
---

# Spot and recover at-risk customer accounts

Set up the tools below, then run the steps in order for the user.

## Inputs

Ask the user for these before you start.

- `drop_threshold`: the usage drop that counts, e.g. 40%
- `renewal_window`: how soon renewal is, e.g. 90 days
- `cs_channel`: where to escalate, e.g. #customer-success

## Set up

### Run a query (Mixpanel, tool:mixpanel/run-query)

Use the MCP server. Add it to your agent's MCP settings, then sign in when asked.

```json
{ "mcpServers": { "mixpanel": { "url": "https://mcp.mixpanel.com/mcp" } } }
```

Call the MCP tool `Run-Query`.

### Stripe (tool:stripe/list-customers, tool:stripe/list-subscriptions)

Use the first option your agent supports.

#### MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

```json
{ "mcpServers": { "stripe": { "url": "https://mcp.stripe.com" } } }
```

- List customers: call the MCP tool `stripe_api_read`
- List subscriptions: call the MCP tool `stripe_api_read`

#### CLI (official)

Install the command, then confirm it runs.

```sh
npm install -g @stripe/cli
stripe --version
```

- List customers: run `stripe customers list`
- List subscriptions: run `stripe subscriptions list`

### Post a message (Slack, tool:slack/post-message)

Use the first option your agent supports.

#### MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

```json
{ "mcpServers": { "slack": { "url": "https://mcp.slack.com/mcp" } } }
```

Call the MCP tool `slack_send_message`.

#### CLI (official)

Install the command, then confirm it runs.

```sh
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash
slack --version
```

Run `slack api chat.postMessage`.

Set `$SLACK_BOT_TOKEN` in your environment first (get a key: https://api.slack.com/apps).

### Generate an email (Brew, tool:brew/generate-email)

Use the first option your agent supports.

#### MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

```json
{ "mcpServers": { "brew": { "url": "https://brew.new/api/mcp" } } }
```

Call the MCP tool `create_email`.

#### CLI (official)

Install the command, then confirm it runs.

```sh
brew install getbrew/tap/brew-cli
brew-cli --version
```

Run `brew-cli emails generate`.

Set `$BREW_API_KEY` in your environment first (get a key: https://brew.new/settings/api).

Make one read-only call to each tool to confirm access.

## Steps

1. **Detect drops** with Run a query (Mixpanel). List accounts whose usage fell more than `drop_threshold` versus the prior 30 days. Keep an email for each account, such as its admin's.
2. **Find their customers** with List customers (Stripe). Look up each email, as stored and lowercased, and keep every customer ID it returns.
3. **Check renewals** with List subscriptions (Stripe). For each customer, keep the accounts whose subscription item's `current_period_end` falls within `renewal_window`.
4. **Escalate** with Post a message (Slack). Post one message per account to `cs_channel` with the usage numbers and renewal date.
5. **Draft the check-in** with Generate an email (Brew). Draft a short check-in email from the account manager for each account. Show the drafts to the user.

## Done when

- Every at-risk account has a Slack post and a drafted email.
- The user has the list ordered by renewal date.

## Rules

- Only use the tools listed above.
- Ask the user before anything that sends messages, costs money, or changes data.
- Never print API keys.
