App recipes
Alert Slack on failed Stripe payments with Duaer
In Duaer, when a Stripe subscription charge fails, post the customer email, amount, attempt count, and invoice link to a Slack channel.
Build the failed payment alert in Duaer
- Add Stripe Trigger, connect the Stripe credential, and set Events to Invoice Payment_failed.
- Add Slack with Resource Message, Operation Send, channel #billing.
- Message: Payment failed {{ $json.data.object.customer_email }}, {{ ($json.data.object.amount_due / 100).toFixed(2) }} {{ $json.data.object.currency.toUpperCase() }}, attempt {{ $json.data.object.attempt_count }}. Invoice: {{ $json.data.object.hosted_invoice_url }}
- Publish the digital organization. Stripe Trigger registers its webhook in Stripe after publishing.
For zero-decimal currencies such as JPY, do not divide the amount by 100.
Test
Use a Stripe test-mode key in the credential. Attach card 4000 0000 0000 0341 (attaches, then declines) to a test customer and start a subscription to get invoice.payment_failed. If the channel stays silent, refer to Fix Slack not_in_channel in Duaer.
Questions
Can Duaer alert on failed one-time Stripe payments too?
Yes. Also select Payment Intent.payment_failed in the Duaer Stripe Trigger and use data.object.amount for the amount.
Can Duaer post to WeCom instead of Slack?
Yes. Replace the Slack node in the Duaer flow with a WeCom group bot; the message stays the same.
In this section
Create a Stripe customer in Duaer
In Duaer, Stripe defaults to Resource Balance. To create a customer, set Resource to Customer, Operation to Create, and set Name. You need a stripeApi credential.
NodesSend a Slack message in Duaer
In Duaer, Slack defaults to Authentication Access Token, Resource Message, and Operation Send. Message Type defaults to Simple Text Message.
ErrorsFix Slack not_in_channel and channel_not_found in Duaer
When the Slack node in Duaer fails with not_in_channel, your Slack app is not a member of that channel. Invite the app to the channel.