Skip to main content
This example builds a churn prevention agent that:
  • Monitors inbox threads for disengagement signals
  • Identifies at-risk customers using extracted data
  • Sends personalized re-engagement emails
  • Tracks delivery and engagement metrics

Architecture

Full implementation

Setup steps

1

Create an inbox

2

Set environment variables

3

Schedule with cron

Or deploy as a Railway cron job, GitHub Action, or any scheduled task runner.

Monitoring results

After running, check your delivery metrics:
Track:
  • Delivery rate — are re-engagement emails reaching inboxes?
  • Bounce rate — are any at-risk customers’ addresses invalid?
  • Response rate — how many customers reply? (check new inbound messages)

Improvements

  • Segmentation — different messages for different inactivity durations
  • A/B testing — vary subject lines and measure open rates
  • Exclude recent re-engagements — don’t email the same person twice in 30 days
  • Sentiment tracking — use extraction schemas to measure response sentiment
  • Escalation — if a customer responds negatively, route to a human

Threads

List and paginate threads to find at-risk customers by last activity.

Delivery Monitoring

Track delivery rates and bounce rates on re-engagement campaigns.

Rate Limits

Understand sending limits when running bulk re-engagement campaigns.

Messages

Send re-engagement emails using the thread ID to continue conversations.
Last modified on March 19, 2026