Recover failed GoCardless payments with email and Slack

By General Input

The moment a GoCardless payment fails, get a ready-to-review recovery email drafted for the customer and a Slack alert for your finance team.

Integrations

  • GoCardless
  • Gmail
  • Slack

Type

Agentic Task

Categories

  • Finance
  • Operations

When a payment fails in GoCardless (the GoCardless payment failed event, delivered by webhook), jump on recovery right away. Build this as an agent rather than a fixed script, because it needs to judge whether the failure is a one-off blip or part of a repeat pattern and then write a customer-appropriate recovery email.

Start from the failed payment in the trigger event. Follow its customer link (the customer id under the payment's links object) and call GoCardless Get Customer to pull the customer's name, email address, and details.

Then call GoCardless List Payments filtered to that same customer and review their recent history. Decide whether this looks like a one-off failure (their payments normally succeed) or a repeat failure (several recent failures, cancellations, or retries). Use that judgement to shape both the tone of the email and the recommendation you post to Slack.

GoCardless returns amounts as integers in the smallest currency unit (pence, cents), so wherever you show an amount, divide by 100 and format it as real money using the payment's currency (for example 4500 GBP becomes GBP 45.00, shown as a proper currency string). Do this in both the email draft and the Slack message, and never show the raw integer.

Draft a friendly, on-brand recovery email as a Gmail draft using Create a Draft, addressed to the customer's email. It should explain plainly that the latest collection failed, reassure the customer that their account is fine and this is easy to fix, state the formatted amount and the failure reason in plain language, and say when we will retry (or invite them to update their bank details if a retry is likely to fail again). Leave it as a draft only and do not send it, so finance can review and edit before it goes out.

Finally, post a Slack alert to the finance channel using Send a Message. Include the customer name, the formatted amount, the failure reason, and whether this is a first-time or repeat failure, followed by a one-line recommendation: auto-retry if it looks like a one-off, or reach out personally if it is a repeat failure or the mandate looks at risk. Mention that a recovery email draft is waiting in Gmail so finance can open, review, and send it.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredChat quality review board for LiveChat support leadsChase the paperwork every new client and vendor still owesFile Gmail attachments into storage with names you can findWin back no-show and cancelled appointments every morningLive Loop returns analytics with product-level drill-downNewsletter pre-flight and approval board for Mailjet sendsTurn a prospect spreadsheet into personalized sequence enrollmentsMailjet email delivery lookup console for support teams