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

By General Input

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.

Integrations

  • Stripe
  • Slack Bot
  • HubSpot

Type

Agentic Task

Categories

  • Finance
  • Operations

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.

Related prompts

Explore more prompts
Let support send one-off Loops emails without an engineerA brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonCustomer lifecycle inspector for Loops, Stripe and PostHogiMessage campaign console with pre-flight checks and delivery boardLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agents