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

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.

Additional information

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.

Frequently asked questions

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.

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.