Sort Stripe buyers into MailerLite groups by spend tier

By General Input

When a Stripe payment succeeds, file the buyer in the right MailerLite group based on amount and lifetime spend, then ping big wins to Slack.

Integrations

  • Stripe
  • MailerLite
  • Slack Bot

Type

Agentic Task

Categories

  • Marketing
  • Sales

Build an agent workflow that fires when Stripe sends a webhook for a successful payment (either charge.succeeded or payment_intent.succeeded). The trigger is a Stripe webhook. Verify the Stripe signing secret on every incoming event before doing any work.

When the event arrives, read the customer ID, amount, and product/description out of the payload. Then call Stripe's Retrieve Customer to get the buyer's email and name. Call Stripe's List Invoices filtered to that customer and sum the paid invoice amounts to compute lifetime spend. Capture the most recent paid invoice date as the last purchase date. Treat the current payment as part of lifetime spend even if its invoice has not landed in the list yet.

Decide which MailerLite group the buyer belongs in based on the current payment amount AND lifetime spend together (not a single field). Use these starter rules and expose them as configurable: VIP if the current payment is at least $500 OR lifetime spend has crossed $2,000. Standard Customer if the current payment is at least $50. Low Ticket otherwise. Group names and dollar thresholds must be easy to edit.

Then write to MailerLite. Call MailerLite's Create or Update Subscriber keyed by the buyer's email, setting custom fields last_product, last_amount, total_ltv, and last_purchase_date. Make the custom field names configurable in case the user has named them differently. After upserting the subscriber, call MailerLite's Assign Subscriber to Group with the chosen tier's group ID so the right post-purchase automation fires.

Finally, if the current payment is high value (default: $500 or more) OR the buyer just crossed a lifetime spend threshold for the first time (default: crossed $2,000), call Slack's Send a Message via the Slack Bot integration into the configured revenue channel. The message should include the buyer name and email, the product/description, the payment amount, the new total LTV, and whether they just hit a new tier (for example 'New VIP'). Use a clean one-line format suitable for a revenue channel. Use Slack Bot, not the user Slack integration, since this is a workspace alert.

Configurable knobs the user should be able to tune without editing code: the Stripe webhook events to listen for, the dollar thresholds for each tier, the MailerLite group IDs for each tier, the MailerLite custom field names, the Slack channel ID, and the minimum amount below which the Slack alert is suppressed. Be defensive: skip silently if the event is a test event or has no associated customer email, and avoid posting to Slack twice for the same event if it gets retried by Stripe.

Related prompts

Explore more prompts
Let support send one-off Loops emails without an engineerA brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonCustomer lifecycle inspector for Loops, Stripe and PostHogLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client account