Recover failed Stripe payments with Brevo emails and CRM tasks

When a Stripe invoice payment fails, send a warm Brevo recovery email, open a follow-up task in the Brevo CRM, and brief your revenue team in Slack.

Agentic Task
StripeBrevoSlackFinanceSalesNotifications & AlertsEmail Automation
PromptCreate

Build me an agent workflow that recovers customers after a failed Stripe payment using Brevo for both the email and the CRM follow-up, and pings our revenue team in Slack.

Trigger: a Stripe webhook for invoice.payment_failed. If the event has no invoice attached, fall back to charge.failed so one-off payments still flow through.

Step 1 — Gather context from Stripe. Call Stripe Retrieve Customer using the customer id on the event to get the customer's name, email, and any metadata I have on them (deal owner, plan tier). Then call Stripe Retrieve Invoice using the invoice id (when present) to get the amount due, currency, attempt count, next payment attempt timestamp, and hosted_invoice_url. If there is no invoice (charge.failed path), use the charge object's amount, currency, and failure_message, and skip the retry date.

Step 2 — Upsert the customer in Brevo. Call Brevo Create Contact with updateEnabled=true using the customer's email, first/last name parsed from the Stripe name, and attributes for STRIPE_CUSTOMER_ID, LAST_FAILED_AMOUNT, LAST_FAILED_AT, and FAILED_PAYMENT_COUNT (increment if the contact already exists). This makes the customer searchable in our Brevo CRM with dunning history attached.

Step 3 — Send a recovery email through Brevo. Use Brevo Send Transactional Email to the customer. Vary the tone based on (a) the attempt count on the invoice and (b) the dollar amount: first attempt and small amount = friendly heads-up, third+ attempt or amount above a configurable threshold (default $500) = more direct, urgent ask with a clear deadline. Always greet by first name, restate the amount and product, embed the hosted_invoice_url as a one-click "Update payment method and finish checkout" button, and mention the next retry date when we have one. If a Brevo transactional template id is configured, use the template and pass the variables in instead of freeform HTML.

Step 4 — Open a Brevo CRM task. Call Brevo Create Task with a title like "Recover $AMOUNT from CUSTOMER NAME (attempt N)", assignee = the deal owner from Stripe metadata (fall back to a default owner I configure), due date = Stripe's next payment attempt (or +2 business days if no retry date), and link it to the Brevo contact created in Step 2. Set priority to High when the failure is urgent (attempt count >= 3 or amount above threshold), otherwise Medium.

Step 5 — Notify the revenue team in Slack. Call Slack Send a Message to the billing channel (configurable, default #revenue) with a four-line summary: customer name + email, amount and currency, attempt number, and a link to the Brevo CRM task created in Step 4. Prefix the message with :rotating_light: Urgent when the failure qualifies as urgent, otherwise :warning:. Keep it tight — four lines, no walls of text.

Edge cases the agent should handle: customer has no email on the Stripe object (skip Brevo steps, still post to Slack noting the missing email so someone can chase it manually); Brevo Create Contact returns a duplicate (re-fetch and continue with the existing contact id); Brevo Create Task fails (still send the Slack message but flag that the task couldn't be created); Stripe Retrieve Invoice fails (proceed with charge-only context).

Use the dunning tone, urgency decision, and task priority as agent judgment calls — that's the whole reason this is an agent and not a static workflow.

What does this prompt do?

  • Listens for failed payments in Stripe and pulls the customer's name, email, amount due, and next retry date in one go.
  • Saves or updates the customer in your Brevo contacts so dunning history lives next to the rest of your CRM.
  • Sends a personalized recovery email through Brevo with a one-click link to fix the card, and tunes the tone to the failure count and dollar amount.
  • Opens a Brevo CRM task for the account owner so a human follows up if the auto-retry doesn't land.
  • Posts a four-line summary to your revenue Slack channel, flagged urgent for high-value or repeat failures.

What do I need to use this?

  • A Stripe account with permission to set up webhooks for failed invoice events.
  • A Brevo account with an API key, a verified sender, and a CRM workspace where the recovery task should land.
  • A Slack workspace and the channel where your revenue or billing team wants to be notified.

How can I customize it?

  • Change the Slack channel, or split notifications between a billing channel and an urgent channel for high-value failures.
  • Adjust what counts as urgent (we default to either a third failure or a charge above a threshold you set).
  • Rewrite the email tone, add your logo, or point the pay link at your own billing portal instead of the hosted Stripe invoice.

FAQs

Does this work for one-off charges that don't have an invoice attached?
Yes. The workflow listens for failed invoice payments first, and falls back to plain failed charges so one-off payments still get a recovery email and a follow-up task.
Will the email actually change wording based on the customer?
Yes. Because this runs as an agent, the email tone adjusts to how many times the customer has already failed and how much money is at stake. First-time, low-dollar failures get a soft nudge; repeat or high-value failures get a more direct ask.
Where does the follow-up task show up in Brevo?
In the Brevo CRM's Tasks list, linked to the customer's contact record, assigned to the deal owner (or a default owner you choose), with a due date matching Stripe's next retry attempt.
Can I use this with my Brevo email templates instead of a freeform message?
Yes. You can point the email step at one of your existing Brevo transactional templates and let the agent fill in the customer's name, amount, retry date, and pay link.
What does the Slack alert look like?
A short four-line summary: who the customer is, what they owe, how many times the payment has failed, and a direct link to the new Brevo CRM task. Repeat failures or high-dollar amounts get an urgent flag at the top.

Related templates

Call overdue Xero customers with an AI collections agent

Every weekday at 10am, an AI voice agent phones your most overdue Xero accounts, logs what each customer promised, and reports back to finance in Slack.

LiveKit
Xero
Deepgram
+2
Agentic Task
Win back LiveChat visitors whose chats went unanswered

Every couple of hours we find the chats your team never answered, email those visitors a real reply, and hand the sensitive ones to a support lead.

LiveChat
Gmail
Slack
Agentic Task
Let support send one-off Loops emails without an engineer

Your team picks a template, finds the customer, checks they are safe to email, then sends it, with every send logged where the whole team can see it.

Loops.so
Stripe
Google Sheets
App
Customer lifecycle inspector for Loops, Stripe and PostHog

Open one screen each morning to see a paying customer's billing, product activity and email history, then send the right next email without leaving it.

Loops.so
Stripe
PostHog
App
Chat quality review board for LiveChat support leads

Score last week's finished live chats against one rubric, let an AI grader draft the notes with quotes, and send coaching straight to the agent.

LiveChat
Slack
General Input Database
App
Win back no-show and cancelled appointments every morning

Every weekday morning, every appointment that fell through yesterday gets a personal text or email inviting them to rebook, plus a task for the right rep.

LeadConnector
Google Sheets
Slack
Agentic Task

Stop letting failed Stripe payments quietly churn your customers.

Connect Stripe, Brevo, and Slack once, and Geni handles the dunning email, the CRM follow-up, and the team alert every time a payment fails.