Stripe Charge Dispute Created Notification to Slack & Email
Use the Stripe integration by MagicBell to setup a workflow when charge.dispute.created triggers in Stripe.
Connect Stripe to MagicBell to receive events and trigger workflows. This guide uses the MagicBell CLI.
Add the Stripe integration
Save your Stripe webhook signing secret in MagicBell. See Stripe webhooks.
magicbell integration save_stripe \
--data '{"webhook_signing_secret":"whsec_xxx"}'Copy the ID from the response and use it to build your webhook URL:
https://api.magicbell.com/v2/integrations/stripe/webhooks/incoming/{id}Setup the webhook
- Setup a webhook in Stripe with the URL from the last step.
- Select the charge.dispute.created event.
- If you already have a webhook configured, make sure it includes this event.
Add a workflow
Create a workflow that triggers automatically when Stripe sends this event.
Workflow key
Use this key to trigger the workflow when Stripe sends a charge.dispute.created:
integration.stripe.charge.dispute.createdExample workflow
Notify the finance team immediately when a dispute is filed so they can respond before the deadline.
{
"key": "integration.stripe.charge.dispute.created",
"steps": [
{
"command": "broadcast",
"input": {
"content": "A ${{payload.data.object.amount}} dispute has been filed. Reason: {{payload.data.object.reason}}. Evidence due by deadline. Dispute ID: {{payload.data.object.id}}",
"overrides": {
"providers": {
"email": {},
"slack": {}
}
},
"recipients": [
{
"external_id": "finance-team"
}
],
"title": "⚠️ New dispute filed"
}
}
]
}Save with the CLI
Use the MagicBell CLI to save this workflow to your project. You can also use the Workflows API endpoint instead.
magicbell workflow save \
--data '{"key":"integration.stripe.charge.dispute.created","steps":[{"command":"broadcast","input":{"content":"A ${{payload.data.object.amount}} dispute has been filed. Reason: {{payload.data.object.reason}}. Evidence due by deadline. Dispute ID: {{payload.data.object.id}}","overrides":{"providers":{"email":{},"slack":{}}},"recipients":[{"external_id":"finance-team"}],"title":"⚠️ New dispute filed"}}]}'Event payload
Sample payload for the charge.dispute.created event. Use liquid templates to access fields in your workflow.
{
"api_version": "2023-10-16",
"created": 1694109621,
"data": {
"object": {
"amount": 2000,
"charge": "ch_1NqIjRLkdIwHu7ixZzJ2Kl5m",
"created": 1694109621,
"currency": "usd",
"evidence_details": {
"due_by": 1695319221,
"has_evidence": false,
"past_due": false,
"submission_count": 0
},
"id": "dp_1NqIjRLkdIwHu7ixYyI1Jk4l",
"livemode": false,
"object": "dispute",
"reason": "fraudulent",
"status": "needs_response"
}
},
"id": "evt_1NqIjSLkdIwHu7ixXxH0Ij3k",
"livemode": false,
"object": "event",
"type": "charge.dispute.created"
}