Multi-tenancy is a common use case for a lot of companies that have multiple organizations that use their applications. In some cases, there is a need to separate the behavior of the notification system depending on the individual tenants.

Currently, Novu supports the following customizations:

  • Workflow level customizations
  • Integration customizations

Tenant Management

Tenants can be created and modified via the API or Web. Each tenant can have multiple fields on it:

  • Identifier - The identifier is a unique value, and can be used later when pointing to this tenant during trigger calls.
  • Name - A human-readable name of the tenant.
  • Data - A custom data object that can store information about the tenant. This data can be later accessed inside workflows.

Workflow Level Customizations

When triggering a workflow, it is possible to pass the tenant information (id or object, in case of an object, novu will upsert the tenant if it’s not existing) like so:

  import { Novu } from '@novu/node';

  const novu = new Novu("<NOVU_SECRET_KEY>");

  await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>',
    {
      to: {
        subscriberId: '<UNIQUE_SUBSCRIBER_IDENTIFIER>',
      },
      payload: {
        name: "Hello World",
      },
      actor: "actorId"
      tenant: "tenantIdentifier"
    }
  );

Integration Level Customizations

When creating an integration, you can create a condition where you can specify a delivery provider for a channel when a particular tenant id is matched.

The delivery provider specified will only be used if the trigger is executed with the tenant id.

Add provider instance

Set conditions

Was this page helpful?