Text customers via ClickSend when Stripe payments fail
When a Stripe invoice payment fails, send the customer a polite ClickSend text with a link to update their card, and log the attempt in HubSpot.
Build a deterministic, node-by-node code workflow that recovers failed Stripe subscription payments by texting the customer via ClickSend and logging the attempt in HubSpot. No reasoning or LLM steps are required, this is straight glue.
Trigger: a Stripe webhook on the invoice.payment_failed event. The webhook payload gives us the invoice id, the customer id, and the current attempt count.
Step 1. Call Stripe Retrieve Invoice with the invoice id from the webhook. Pull out amount_due, currency, hosted_invoice_url, attempt_count, and customer_email.
Step 2. Guard clause on attempt_count. Only continue past this step when attempt_count is 1 or 3. For any other attempt (2, 4, 5, etc.), short-circuit the workflow so we never spam the customer on every Stripe retry. This anti-spam gate is the whole point of the workflow.
Step 3. Call Stripe Retrieve Customer with the customer id. Pull out name, email, and phone. If phone is missing or empty, skip the ClickSend step entirely but still continue to the HubSpot logging steps so we have an audit record of a failed payment we could not text about.
Step 4. Call ClickSend Send SMS with a single message to the customer's phone number. Use a templated body like: "Hi {name}, we could not process your {amount} {currency} payment for {business_name}. You can update your card here: {hosted_invoice_url}". Format amount as a human-readable currency string (divide by 100 for USD-style zero-decimal handling, respect Stripe's smallest-currency-unit rule). The business_name should be a configurable constant on the workflow, not derived from Stripe. Phone must be in E.164 with a leading plus.
Step 5. Call HubSpot Get Contact by the customer's email using idProperty=email. If no contact is found (404), record that in the run log and skip step 6 but do not fail the workflow.
Step 6. Call HubSpot Create Note associated to that contact. The note body should record the failed amount, the attempt number, whether an SMS was dispatched (and to what number, masked), and the hosted invoice URL. Use the contact association type appropriate for the notes-to-contact link in HubSpot v3.
Configuration inputs to expose on the workflow: business_name (string, shown in the SMS body), attempt_numbers_to_notify (default [1, 3]), and a masked-phone toggle for the note body.
Idempotency: the Stripe webhook can redeliver, so key the run by (invoice_id, attempt_count). If we have already run this pair, no-op.
Integrations: Stripe (Retrieve Invoice, Retrieve Customer), ClickSend (Send SMS), HubSpot (Get Contact, Create Note). All operations are verified against the platform catalog.
Additional information
What does this prompt do?
- Reacts to a Stripe payment failure the moment it happens, no batch jobs or delays.
- Sends the customer a friendly ClickSend text with the failed amount, your business name, and a one-tap link to update their card.
- Only texts on the first and third failed attempts, so customers do not get spammed on every Stripe retry.
- Skips the SMS if there is no mobile number on file, and still keeps the audit trail intact.
- Files a note on the matching HubSpot contact recording the amount, attempt number, and that a text was sent.
What do I need to use this?
- A Stripe account you can add a webhook to from the dashboard.
- A ClickSend account with SMS credit and, ideally, a sender ID or number configured.
- A HubSpot account with permission to read contacts and create notes.
- Mobile phone numbers stored on your Stripe customer records in international format.
How can I customize it?
- Edit the SMS wording, your business name, and the recovery link language.
- Change which attempt numbers trigger a text, for example every attempt for high-value plans or only attempt 2.
- Add a Slack ping in parallel, or route the note into a different CRM instead of HubSpot.
Frequently asked questions
What happens if the customer has no phone number on file?
Will the customer be texted every time Stripe retries the card?
Does this work for international customers?
What if there is no matching HubSpot contact for the customer email?
Can I keep the HubSpot note but skip sending the SMS?
Related templates
Stop losing revenue to failed cards you never followed up on.
Connect Stripe, ClickSend, and HubSpot once, and every failed payment gets a polite text and a CRM note automatically.