Skip to main content

Overview

Tenant-specific inboxes enable you to create isolated notification experiences that respect your application’s organizational boundaries. By configuring tenant context in both your notification sending and SDK initialization, you can ensure users only see messages relevant to their current organizational context. This is particularly powerful for B2B SaaS applications where users may belong to multiple organizations, teams, or projects, each requiring separate notification streams.

Tenant Message Visibility

Messages sent with tenant context are only visible when the SDK is initialized with the same tenant ID. For example, if you send an inbox notification to user1 with context tenantA but do not instantiate the Inbox SDK with tenantA, the user will not see the message. This isolation allows you to build inbox configurations that map to your different workspaces, ensuring users only see contextually relevant notifications.
TENANT AUTO-INFERCourier may also be auto-inferring the Tenant based on a single-user tenant membership, so if you have created tenant memberships, you need to set up your Inbox and Toast SDKs with a tenantId. More details on auto-infer here

SDK Configuration

React Components

You can instantiate the Courier React Inbox and Toast components with tenant context:
// Show inbox for specific tenant context
<CourierProvider clientKey="..." userId="user1" tenantId="tenantA">
  <Inbox />
  <Toast />
  {children}
</CourierProvider>

// Dynamic tenant switching example
const [currentTenant, setCurrentTenant] = useState("acme-corp");

<CourierProvider clientKey="..." userId="user1" tenantId={currentTenant}>
  <select onChange={(e) => setCurrentTenant(e.target.value)}>
    <option value="acme-corp">Acme Corp</option>
    <option value="beta-inc">Beta Inc</option>
  </select>
  <Inbox />
</CourierProvider>

JavaScript Components

For vanilla JavaScript implementations, configure the tenant during initialization:
// Initialize with specific tenant
window.courier.init({
  clientKey: "...",
  userId: "user1",
  tenantId: "tenantA",
});

// Switch tenant context dynamically
function switchTenant(newTenantId) {
  window.courier.init({
    clientKey: "...",
    userId: "user1", 
    tenantId: newTenantId,
  });
}

Common Issues

Tenant Context Mismatch

If messages aren’t appearing in the inbox, verify that:
  • The message was sent with the same tenant_id used in SDK initialization
  • Auto-infer behavior isn’t affecting tenant context (see auto-infer documentation)
  • User has proper tenant membership if required