Recover failed GoCardless payments with email and Slack
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.
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.
Additional information
What does this prompt do?
- Watches your GoCardless account and springs into action the instant a payment fails.
- Checks the customer's recent payment history to tell a one-off hiccup apart from a repeat problem.
- Writes a friendly recovery email for the customer as a draft, ready for your team to review before it goes out.
- Posts a Slack alert to your finance channel with the customer, amount, failure reason, and whether to auto-retry or reach out personally.
What do I need to use this?
- A GoCardless account that collects Direct Debit, ACH, or open-banking payments.
- A Gmail account for drafting the customer recovery email.
- A Slack workspace with a finance or billing channel for the alerts.
How can I customize it?
- Change the tone and wording of the recovery email to match your brand voice.
- Point the alert at whichever Slack channel your finance team actually watches.
- Adjust when the workflow suggests auto-retrying versus reaching out to the customer personally.
Frequently asked questions
Does it send the recovery email automatically?
How does it know if this is a repeat problem?
Will the amounts show up correctly?
What does the Slack alert include?
Do I need to be a developer to set this up?
Related templates
Stop letting failed payments slip through the cracks.
Turn every failed GoCardless collection into an instant recovery email draft and a finance-team alert.