Invoke Courier automations with tenant context to apply tenant-specific branding, profile overrides, and preferences to recipients in multi-tenant apps.
When working with multi-tenant applications, you often need to send notifications that reflect tenant-specific configurations—such as custom branding, profile data overrides, or tenant-scoped preferences. This tutorial shows you how to invoke an automation with tenant context so that Courier applies the correct tenant configuration to each recipient.
For this example, say we want to invoke an automation for a whole tenant and send admins one message and non-admins a different message. We can create a simple automation that looks at the user’s profile and check the user’s role.
Automation Conditional Flow
To send an automation with tenant context, you need to:
Pass the tenant_id in the automation invocation payload (in both profile and data)
Configure the automation’s send node to use the tenant context from the data payload
This ensures that when the automation executes, Courier applies the tenant-specific configuration to the notification.
The context.tenant_id field tells Courier to apply tenant-specific configuration. The value "$ref": "data.context" references the tenant context object you passed in the automation invocation and merges it into the context for the automation.