Stripe Customer Created Notification to Slack & Email
Use the Stripe integration by MagicBell to setup a workflow when customer.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 customer.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 customer.created:
integration.stripe.customer.createdExample workflow
Notify the sales team when a new customer is created in Stripe.
{
"key": "integration.stripe.customer.created",
"steps": [
{
"command": "broadcast",
"input": {
"content": "New customer created: {{payload.data.object.name}} ({{payload.data.object.email}}). Customer ID: {{payload.data.object.id}}",
"overrides": {
"providers": {
"slack": {}
}
},
"recipients": [
{
"external_id": "sales-team"
}
],
"title": "New customer"
}
}
]
}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.customer.created","steps":[{"command":"broadcast","input":{"content":"New customer created: {{payload.data.object.name}} ({{payload.data.object.email}}). Customer ID: {{payload.data.object.id}}","overrides":{"providers":{"slack":{}}},"recipients":[{"external_id":"sales-team"}],"title":"New customer"}}]}'Event payload
Sample payload for the customer.created event. Use liquid templates to access fields in your workflow.
{
"api_version": "2023-10-16",
"created": 1694109681,
"data": {
"object": {
"created": 1694109681,
"description": "New customer",
"email": "customer@example.com",
"id": "cus_Na6dX7aXxi11N4",
"livemode": false,
"name": "Jenny Rosen",
"object": "customer",
"phone": "+1234567890"
}
},
"id": "evt_1NqIkSLkdIwHu7ixAaK3Lm6n",
"livemode": false,
"object": "event",
"type": "customer.created"
}