Text dunning iMessages from Sendblue when Stripe charges fail

When a Stripe charge fails, send a friendly, AI-drafted iMessage with a retry link from Sendblue and log the attempt on the matching HubSpot contact.

Agentic Task
StripeSendblueHubSpotFinanceCustomer SupportNotifications & AlertsEmail Automation
PromptCreate

Build an agent workflow that recovers failed Stripe payments by texting the customer an iMessage from Sendblue and logging the attempt in HubSpot.

Trigger: a Stripe webhook on the charge.failed event. The webhook payload is the failed charge, including the customer id, amount, currency, and failure reason.

When the trigger fires, the agent should:

1. Call Stripe Retrieve Customer with the customer id from the webhook to get the customer's email and name.

2. Call HubSpot Search Contacts on that email to find the matching contact. Pull back the phone number, lifecycle stage, and any properties that indicate past dunning history (for example, the number of recent failed payment notes on the contact). If no contact is found, stop and do nothing.

3. Decide whether to send. Skip sending if the contact has no phone number, or if the failed amount is below a configurable threshold (default: $10 USD equivalent). When you skip, still record a HubSpot note explaining why no message was sent.

4. Compose the message. Draft a short, friendly iMessage that opens with the customer's first name, explains that the card on file just declined on a charge of [amount] for [product or invoice description if available], gives the human-readable failure reason in plain language (for example, "your bank declined the card" instead of generic_decline), and includes a retry payment link. Choose tone based on past dunning attempts: first failure stays casual and apologetic, repeat failures (two or three) get more direct, and after four or more failures keep the tone calm but explicit that the account is at risk.

5. Send the message via Sendblue Send Message to the customer's phone number from your configured Sendblue line. Use E.164 format for the number.

6. Call HubSpot Create Note on the matched contact recording: the failure reason from Stripe, the charge amount and currency, a link to the charge in Stripe, the exact iMessage that was sent, and the Sendblue message id for traceability.

Make the threshold amount and the retry link template configurable inputs so I can tune them without editing the workflow. Where the customer is not in HubSpot, the workflow should exit cleanly and not error.

What does this prompt do?

  • Catches every failed Stripe charge the moment it happens and starts a recovery flow without anyone in finance lifting a finger.
  • Drafts a short, friendly iMessage that explains what failed, includes a retry link, and adjusts tone based on whether this is a first slip or a repeat issue.
  • Skips sending automatically when the customer's phone number is missing or the failed amount is below a threshold you set.
  • Logs the failure reason, amount, and the exact message you sent as a note on the customer's HubSpot contact so support and revenue can see the full picture.

What do I need to use this?

  • A Stripe account where you can receive payment events.
  • A Sendblue account with an iMessage line ready to send from.
  • A HubSpot login with permission to read contacts and create notes.
  • Customer phone numbers stored on your HubSpot contacts so the message can find a recipient.

How can I customize it?

  • Change the minimum amount that triggers a text, so small failed charges quietly retry on their own.
  • Adjust the tone ladder, for example casual on the first try, firmer after two or three failures, and an internal escalation after five.
  • Swap the retry link for your billing portal, an Apple Pay link, or a Stripe-hosted update card page.
  • Add a follow-up step like creating a HubSpot task for your CS team when a customer has failed three or more times.

FAQs

Why iMessage instead of email for payment recovery?
Failed payment emails get lost in promotions tabs and spam filters. An iMessage lands in the customer's main thread next to friends and family, which is why teams that switch to text dunning typically see meaningfully higher recovery rates.
What if I do not have the customer's phone number?
The workflow checks HubSpot for a phone number before sending. If there isn't one, it skips the text and still logs a note on the contact so your team knows the failure happened and that no message went out.
Will this spam customers who already paid?
No. The flow only fires on a confirmed failed charge from Stripe, and you can set a minimum amount so trivial failures do not bother anyone. You can also pause the workflow from your dashboard at any time.
Does it work with HubSpot Free?
Yes. The workflow only needs to read contact properties and add notes, which are supported on every HubSpot tier including Free.
Can I keep my own brand voice in the message?
Yes. The draft is generated by the agent, but you can pin a tone, a signature, and a few example messages so every text sounds like your company.

Related templates

Rank your Intercom queue by what each customer pays you

See every open conversation next to that customer's plan, monthly value and unpaid invoices, so the expensive account never sits waiting all morning.

Intercom
Stripe
App
Client-by-client cold email pipeline review for agencies

Pick a client and a date range to see sent, replies, meetings booked and the real deal value your cold email produced, campaign by campaign.

Instantly
HubSpot
Slack Bot
App
Partner tier review board for quarterly promotion calls

Work every partner tier decision from one board, with the revenue and commission numbers, clear promotion thresholds, and AI review briefs.

Introw
HubSpot
Slack
App
Reconcile partner commissions between HubSpot and Introw

Open one board at month end to find every closed deal missing a commission, every commission with no deal behind it, and every amount that does not add up.

Introw
HubSpot
Slack
App
Catch the trials quietly dying before the card gets charged

Open one desk each morning to see every account still in a trial, ranked by how much money is at stake against how little they have actually used.

Intercom
Stripe
General Input Database
App
Hiring signal board for your customers and open pipeline

Open one board each morning to see which of your accounts are hiring, what they are building, and where your product fits the roles they just opened.

JobsPipe
HubSpot
App

Stop losing revenue to silent failed charges.

Connect Stripe, Sendblue, and HubSpot once, and Geni texts every customer with a failed charge before they even notice.