Text customers when Stripe payments fail and alert your billing team

By General Input

When a Stripe payment fails, text the customer a tap-to-pay link and post a structured alert in your billing Slack channel so nothing slips.

Integrations

  • Stripe
  • Twilio
  • Slack Bot

Type

Deterministic Code

Categories

  • Finance
  • Operations

Build me a deterministic code workflow that runs SMS dunning on Stripe failed payments and alerts our billing team in Slack. No reasoning needed — every step is fixed.

Trigger: a Stripe webhook for invoice.payment_failed (and optionally charge.failed as well). The workflow should fire once per webhook event.

Step 1 — Look up the customer. Take the customer ID from the webhook payload and call Stripe's Retrieve Customer to fetch their name, email, and stored phone number. From the same webhook payload, capture the failed amount, the invoice number, the hosted invoice URL, and the current attempt count.

Step 2 — Send the customer an SMS via Twilio (only if a phone number is present on the customer). Use Twilio's Send a Message operation to send a friendly text that includes the customer's first name, the failed amount formatted as currency, the invoice number, and the hosted invoice URL so they can update their card in one tap. Example tone: "Hi {first_name}, your payment of {amount} for invoice {number} didn't go through. Update your card here: {hosted_invoice_url}." If the customer has no phone number on file, skip the SMS step silently and continue.

Step 3 — Always post a structured alert to our billing Slack channel using Slack Bot's Send a Message. The message should include the customer name, the failed amount, the attempt count, whether the SMS went out or was skipped, and a clickable link to the Stripe invoice so finance can follow up if the SMS retry doesn't work.

Configuration the user should be able to set up front: the Slack channel ID, the Twilio sending phone number, and which Stripe events to subscribe to (invoice.payment_failed only, charge.failed only, or both). Keep the flow deterministic — no LLM calls, no judgement, just fetch and notify.

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