AI-personalized SMS recovery for failed Stripe payments

By General Input

When a Stripe payment fails, an agent writes a friendly, customer-specific text with a one-tap link to update the card, then logs the recovery in your billing Slack channel.

Integrations

  • Stripe
  • Twilio
  • Slack Bot

Type

Agentic Task

Categories

  • Finance
  • Operations

Build me an agent workflow that recovers failed Stripe payments with a personalized SMS instead of a generic dunning email, and keeps our billing team in the loop in Slack.

Trigger: a Stripe webhook on the invoice.payment_failed event. The workflow should fire once per webhook delivery.

Step 1 — Gather context. From the webhook payload, take the invoice ID and the customer ID. Use Stripe's Retrieve Invoice operation to pull the amount due, the invoice number, the hosted invoice URL, the next payment attempt date, the current attempt count, and the line items (so we know which product or subscription this is for). Use Stripe's Retrieve Customer operation to pull the customer's name, email, and stored phone number.

Step 2 — Decide what to do. If the customer has no phone number on file, skip the SMS step entirely and go straight to logging in Slack. Otherwise, continue.

Step 3 — Draft the SMS. Write a short, friendly text in the customer's voice, under 320 characters total. It must include the customer's first name, the exact product or subscription name from the invoice line items, the amount due formatted as currency, and the hosted invoice URL so they can update their card in one tap. Shift the tone based on the attempt count: warm and apologetic on attempt one, a little more direct on attempt two, and matter-of-fact on attempt three or later. Do not invent details that are not in the Stripe data.

Step 4 — Send the SMS. Use Twilio's Send a Message operation. The To number is the phone on the Stripe customer record (already in E.164 format if it was collected through Stripe Checkout). The From number is the user's configured Twilio sending number. The body is the SMS the agent drafted.

Step 5 — Post a paper trail. Use Slack Bot's Send a Message operation to post a one-line summary in the configured billing channel (#billing by default). The Slack message should include the customer name, the amount, which attempt this is, whether the SMS went out or was skipped because there was no phone number, and the full SMS body so finance can see exactly what the customer received. Include the hosted invoice URL as a clickable link.

Things the user should be able to configure up front: the Slack channel ID for billing alerts, the Twilio sending phone number, and an optional opt-out line to append to every SMS (for example "Reply STOP to opt out").

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