Examples / Weekly churn watch

Weekly churn watch

Each Monday, query your warehouse for accounts whose usage dropped, score them in JavaScript, and have a model draft a personal check-in for the customer success team.

PostgreSQLJavaScriptYour AI modelsSlack

What you tell the assistant

Every Monday morning, find customers whose weekly active users dropped more than 30%, rank them by revenue, and post the top five to #customer-success with a drafted check-in message for each.

Why it works

  • Read-only SQL against your own warehouse — credentials never leave the connection.
  • Scoring logic lives in versioned JavaScript you can read and change.
  • The team gets drafts, not auto-sent emails. Humans stay in the loop.
Build this workflow

What it builds

Trigger
Schedule
0 8 * * 1 · America/New_York
tool
Query usage drop
warehouse.query
javascript
Score and rank
→ top
llm
Draft check-ins
smart
tool
Post to #customer-success
slack.post_message
View the definition
trigger:
  kind: schedule
  cron: "0 8 * * 1"
  timezone: America/New_York
steps:
  - key: usage
    name: Query usage drop
    kind: tool
    tool: warehouse.query
    args:
      sql: |
        select account_name, mrr, wau_this_week, wau_last_week
        from weekly_account_usage
        where wau_last_week > 0 and wau_this_week < wau_last_week * 0.7
  - key: rank
    name: Score and rank
    kind: javascript
    inputs: { rows: "{{ steps.usage.output.rows }}" }
    outputs: { top: array }
    code: |
      function main({ rows }) {
        const scored = rows.map(r => ({ ...r, drop: 1 - r.wau_this_week / r.wau_last_week }))
          .sort((a, b) => b.mrr * b.drop - a.mrr * a.drop)
        return { top: scored.slice(0, 5) }
      }
  - key: drafts
    name: Draft check-ins
    kind: llm
    model: smart
    prompt: "For each account, write a two-sentence friendly check-in from their CSM. Format as a Slack list. {{ steps.rank.output.top }}"
  - key: post
    name: "Post to #customer-success"
    kind: tool
    tool: slack.post_message
    args: { channel: C06SUCCESS, text: "*Accounts going quiet this week*\n{{ steps.drafts.output.text }}" }

A sample run

What each step produces

Query usage drop tool

succeeded
Calling warehouse.query
{
  "columns": [
    "account_name",
    "mrr",
    "wau_this_week",
    "wau_last_week"
  ],
  "rows": [
    {
      "account_name": "Contoso",
      "mrr": 4200,
      "wau_this_week": 31,
      "wau_last_week": 58
    },
    {
      "account_name": "Fabrikam",
      "mrr": 1800,
      "wau_this_week": 12,
      "wau_last_week": 40
    }
  ],
  "row_count": 2,
  "truncated": false
}

Score and rank javascript

succeeded
{
  "top": [
    {
      "account_name": "Contoso",
      "mrr": 4200,
      "drop": 0.47
    },
    {
      "account_name": "Fabrikam",
      "mrr": 1800,
      "drop": 0.7
    }
  ]
}

Draft check-ins llm

succeeded
Using model smart (Claude Sonnet 5, Murmurator AI)
{
  "text": "• *Contoso* — Hi Dana, noticed your team's been a little quieter in Murmurator this week. Anything we can help unblock?\n• *Fabrikam* — Hey Chris, want to hop on 15 minutes to look at the new digest workflows together?"
}

Post to #customer-success tool

succeeded
Calling slack.post_message
{
  "channel": "C06SUCCESS",
  "ts": "1758456000.000500"
}

Trigger payload

{
  "scheduled_at": "2026-09-21T12:00:00Z"
}

Your next automation is one sentence away.

14-day free trial with $5 of built-in AI included. Cancel anytime.