Workflows / Stripe / invoice.overdue

Stripe Invoice Overdue Notification to Slack & Email

Use the Stripe integration by MagicBell to setup a workflow when invoice.overdue 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 invoice.overdue 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 invoice.overdue:

integration.stripe.invoice.overdue

Example workflow

Send overdue notice to customer and escalate to collections team.

{
  "key": "integration.stripe.invoice.overdue",
  "steps": [
    {
      "command": "broadcast",
      "input": {
        "action_url": "{{payload.data.object.hosted_invoice_url}}",
        "content": "Your invoice {{payload.data.object.number}} for ${{payload.data.object.amount_due}} is overdue. Please pay immediately to avoid service interruption.",
        "recipients": [
          {
            "external_id": "{{payload.data.object.customer}}"
          }
        ],
        "title": "Invoice overdue"
      }
    },
    {
      "command": "broadcast",
      "input": {
        "content": "Invoice {{payload.data.object.number}} for customer {{payload.data.object.customer_name}} is overdue. Amount: ${{payload.data.object.amount_remaining}}",
        "overrides": {
          "providers": {
            "slack": {}
          }
        },
        "recipients": [
          {
            "external_id": "collections-team"
          }
        ],
        "title": "Overdue invoice"
      }
    }
  ]
}

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.invoice.overdue","steps":[{"command":"broadcast","input":{"action_url":"{{payload.data.object.hosted_invoice_url}}","content":"Your invoice {{payload.data.object.number}} for ${{payload.data.object.amount_due}} is overdue. Please pay immediately to avoid service interruption.","recipients":[{"external_id":"{{payload.data.object.customer}}"}],"title":"Invoice overdue"}},{"command":"broadcast","input":{"content":"Invoice {{payload.data.object.number}} for customer {{payload.data.object.customer_name}} is overdue. Amount: ${{payload.data.object.amount_remaining}}","overrides":{"providers":{"slack":{}}},"recipients":[{"external_id":"collections-team"}],"title":"Overdue invoice"}}]}'

Event payload

Sample payload for the invoice.overdue event. Use liquid templates to access fields in your workflow.

{
  "api_version": "2023-10-16",
  "created": 1694109921,
  "data": {
    "object": {
      "amount_due": 1000,
      "amount_paid": 0,
      "amount_remaining": 1000,
      "created": 1692900321,
      "currency": "usd",
      "customer": "cus_Na6dX7aXxi11N4",
      "customer_email": "customer@example.com",
      "customer_name": "Jenny Rosen",
      "due_date": 1693505121,
      "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1M2JTkLkdIwHu7ix/live_YWNjdF8xTTJKVGtMa2RJd0h1N2l4",
      "id": "in_1NqIoRLkdIwHu7ixKkU3Vw6x",
      "livemode": false,
      "number": "INV-0042",
      "object": "invoice",
      "status": "open"
    }
  },
  "id": "evt_1NqIoSLkdIwHu7ixJjT2Uv5w",
  "livemode": false,
  "object": "event",
  "type": "invoice.overdue"
}
View all Stripe workflows →