Alert Slack and open a HubSpot dunning task on failed Stripe charges

When Stripe reports a charge.failed event, post a plain English alert in Slack and open a HubSpot follow-up task for the deal owner.

Agentic Task
StripeSlack BotHubSpotFinanceOperationsNotifications & AlertsData Sync

Build me an agent workflow that turns failed Stripe charges into a structured Slack alert and a HubSpot follow up task so dunning actually gets owned.

Trigger: an incoming Stripe webhook on the charge.failed event. Configure the workflow URL as a Stripe webhook endpoint and subscribe only to charge.failed.

When the webhook fires, the agent should:

1. Call Stripe Retrieve Charge with the charge id from the event to get the amount, currency, failure_code, failure_message, outcome reason, and customer id.

2. Call Stripe Retrieve Customer to pull the customer email, name, and any metadata we use to identify accounts.

3. Call Stripe List Charges filtered to that customer for the last 30 days so the agent can see whether this is a one off or part of a repeat pattern, and whether the customer has any successful charges on file.

4. Apply noise control before alerting. Skip the alert if the amount is under a configurable low value threshold (default $20) AND there have been no other failures from this customer in the last 24 hours. Otherwise continue.

5. Post a message to a configurable Slack channel (default #billing-alerts) using Slack Bot Send a Message. The message should be plain English, not a raw Stripe payload. Include: customer name and email, amount and currency, a human readable decline reason translated from failure_code and failure_message (for example, insufficient funds, expired card, do not honor), the count of failures in the last 30 days, the date of the last successful charge, and a link to the charge in the Stripe dashboard.

6. If the charge is high value (default amount over $250) OR the customer has 2 or more failed charges in the last 30 days, also call HubSpot Create Task. The task subject should read "Dunning follow up: <customer name> failed payment". Set due date to tomorrow, priority HIGH, and put the failure reason, amount, customer email, and Stripe charge link in the task body. Associate the task to the customer's HubSpot contact and open deal when they exist, and assign it to the deal owner. If there is no deal owner, fall back to a configurable default owner.

Make these inputs configurable at setup: the Slack channel, the low value threshold for noise suppression, the high value threshold for opening a HubSpot task, the repeat failure window and count, and the fallback HubSpot task owner.

Do not retry the workflow on transient Stripe webhook redeliveries for the same charge id. Treat each unique charge id as a single event.

Additional information

What does this prompt do?
  • Listens for Stripe charge.failed webhooks and pulls the charge, customer, and recent payment history.
  • Posts a structured alert to a configurable Slack billing channel that explains the decline reason in plain English, not raw Stripe codes.
  • Opens a HubSpot task for the deal owner when the failure is high value or part of a repeat pattern, so dunning gets a real human follow up.
  • Suppresses noise from transient retries on small charges so the channel only pings on signals that actually matter.
What do I need to use this?
  • A Stripe account with permission to configure webhook endpoints and read charges and customers.
  • A connected Slack workspace via Slack Bot, with the bot invited to your billing channel.
  • A HubSpot account with permission to create tasks and read deal owners.
  • A target Slack channel name (for example #billing-alerts) and the thresholds you want for high value vs low value charges.
How can I customize it?
  • Change the Slack channel, message format, and which fields appear in the alert (amount, decline reason, customer email, last successful charge).
  • Tune the noise control rules: dollar threshold for what counts as high value, how many recent failures trigger a HubSpot task, and whether to skip duplicate alerts within a time window.
  • Decide who gets the HubSpot task: the deal owner, the contact owner, or a fallback billing queue when no owner is set.

Frequently asked questions

Which Stripe event triggers this workflow?
The Stripe webhook for charge.failed. Stripe sends the event to the workflow URL, the agent retrieves the full charge and customer, and then decides whether to alert and whether to open a HubSpot task.
Will every failed charge ping Slack?
No. The agent applies basic noise control so transient retries on low value charges do not page the channel. You configure the dollar threshold and the repeat failure rule when you set it up.
How does the agent translate Stripe decline codes into plain English?
It reads the failure_code, failure_message, and outcome reason from the retrieved charge, then rewrites them into a human readable sentence (for example, insufficient funds, expired card, or issuer declined) in the Slack post.
Who gets the HubSpot dunning task?
By default the agent looks up the customer in HubSpot, finds the open deal, and assigns the task to the deal owner. You can change the assignment rule during setup, including a fallback owner when no deal is associated.
Can I send to more than one Slack channel?
Yes. You can route by amount or product. For example, send all failures to #billing-alerts and only enterprise tier failures to #revenue-leadership.

Stop letting failed Stripe charges sit unowned.

Connect Stripe, Slack, and HubSpot once, and Geni alerts the right channel and opens the right task every time a charge fails.