Telegram alerts for failed Stripe payments

Get an instant Telegram ping the moment a Stripe charge or invoice payment fails, so revenue issues never sit unseen in an email inbox.

Deterministic Code
StripeTelegramFinanceOperationsNotifications & Alerts
PromptCreate

Build me a code workflow that sends an instant Telegram alert every time a Stripe payment fails, so I notice revenue problems in real time instead of finding them in an email digest the next morning.

Trigger: a Stripe webhook. Register the workflow as a Stripe webhook endpoint and subscribe to two event types: charge.failed (covers one-off payments and direct charges) and invoice.payment_failed (covers subscription renewals). Both event types should route into the same workflow and produce the same alert format. Verify the Stripe-Signature header on incoming requests so we ignore anything that isn't really from Stripe.

Extract these fields from the event payload, handling both event shapes:

- Customer email (from charge.billing_details.email, charge.receipt_email, or the customer record on the invoice, whichever is present) - Amount and currency (amount in the smallest currency unit, formatted back to a human-readable string like "$49.00 USD") - Failure reason: prefer failure_message, fall back to failure_code, then outcome.seller_message. For invoice.payment_failed, use the latest charge's failure_message or attempt_count + next_payment_attempt context. - Customer name or Stripe customer id, whichever is available - A direct deeplink to the charge or invoice in the Stripe dashboard (https://dashboard.stripe.com/payments/{charge_id} for charges, https://dashboard.stripe.com/invoices/{invoice_id} for invoices). Use the test-mode subdomain if livemode is false.

Format the alert as a short, scannable Telegram message using this template:

🚨 Stripe payment failed Customer: {name or email} Amount: {formatted_amount} {currency} Reason: {failure_reason} Type: {one-off charge | subscription renewal} → Open in Stripe: {dashboard_url}

Send the message via Telegram's Send Message operation. Default the destination to "me" so it lands in the operator's own Saved Messages, but expose the peer as a single configurable input so it can be retargeted to any chat, group, or channel without editing code. Use plain text formatting (not HTML or Markdown parse modes) so the template is robust against customer names containing special characters.

Respond to the webhook with HTTP 200 immediately after the Telegram send succeeds. If the Telegram send fails (FloodWaitError or network error), log it but still return 200 so Stripe doesn't retry the webhook and double-alert. This is a deterministic pipeline with no agent reasoning: webhook in, template render, message out.

Additional information

What does this prompt do?
  • Listens for Stripe's failed payment events the second they happen, so you find out in real time instead of the next morning.
  • Sends a tight, scannable alert to your Telegram with the customer email, amount, currency, and why the card was declined.
  • Includes a direct link to the failed charge in your Stripe dashboard so you can investigate in one tap.
  • Covers both one-off charges and subscription renewals, so nothing slips through whether you sell once or bill monthly.
What do I need to use this?
  • A Stripe account with admin access to add a webhook endpoint.
  • A Telegram account connected to General Input. By default the alert goes to your own Saved Messages, but you can point it at any chat, group, or channel you're in.
  • Optional: a dedicated finance or revenue chat if you'd rather route alerts to your team than to yourself.
How can I customize it?
  • Change the destination from your Saved Messages to a specific finance chat, group, or channel.
  • Edit the message template to add or remove fields, mention a teammate, or change the tone.
  • Filter which failures alert you, for example only above a certain amount, only live mode, or only specific failure reason codes.

Frequently asked questions

Will this work for subscription renewals as well as one-off purchases?
Yes. The workflow listens for both kinds of failure events Stripe emits, so a declined renewal on a monthly plan and a failed one-off checkout both fire the same alert.
Can the alert go to a group chat instead of my Saved Messages?
Yes. By default the alert lands in your own Saved Messages so only you see it, but you can change the destination to any group, channel, or direct message your Telegram account has access to.
How fast does the alert arrive after a payment fails?
Within seconds. Stripe pushes the event to the workflow as soon as the payment fails, and Telegram delivers the message immediately. There's no polling delay.
What's actually in the message?
Customer email, amount and currency, the reason Stripe gave for the failure, and a direct link to the charge in your Stripe dashboard. The format is short on purpose so it reads cleanly on a phone.
Will failed test payments ping me too?
Only if you wire the workflow to your Stripe test mode. Most teams connect the live endpoint so only real failures alert them, and leave test failures quiet.

Related templates

Recover failed Stripe payments with friendly Gladly care

When a Stripe payment fails, we find the customer in Gladly, log the details, open a follow-up task, and send a warm note to update their payment method.

Gladly
Stripe
Agentic Task
Sync Stripe subscription status to your Firebase users

The moment a customer's Stripe subscription changes, we update their Firebase user record so their paid access always matches their real billing status.

Stripe
Firebase
Deterministic Code
Audit failed Stripe payments in DynamoDB with a Slack triage note

When a Stripe charge fails, save the failure to your DynamoDB audit table with duplicate protection and post a Slack triage line that says how worried to be.

Amazon DynamoDB
Stripe
Slack Bot
Agentic Task
Log Stripe subscription cancellations to Amplitude and a churn sheet

The moment a Stripe subscription cancels, record a churn event in Amplitude and add a row to your finance and CS churn tracker sheet.

Stripe
Amplitude
Google Sheets
Deterministic Code
Send branded Stripe payment receipts with Amazon SES

Every time a Stripe payment succeeds, email your customer a clean, branded HTML receipt from your own verified Amazon SES address instead of the default Stripe template.

Stripe
Amazon SES
Deterministic Code
Welcome new Stripe customers in MailForge and Slack

The moment someone pays in Stripe, add them to your MailForge welcome list and post the win to Slack so your team sees every new customer in real time.

Stripe
MailForge
Slack Bot
Agentic Task

Stop finding out about failed payments tomorrow morning.

Connect Stripe and Telegram once, and the next failed payment lands in your pocket in seconds.