Tenant Workflows

Learn how to handle multi-tenant notifications

Tenants represents a segment that user belongs to. It can be organizations, teams within an organization, subsidiary companies or different product lines in the same business. In SuprSend, you can dynamically manage tenant level notification customizations. This includes the ability to customize template design or content, set different notification preferences at the tenant level, route notifications via tenant vendors or even have a distinct set of notifications for each tenant. All of this can be managed dynamically within SuprSend by defining tenant settings once and passing **tenant_id** in your event or workflow call. Know more about how to manage tenants within SuprSend here.

πŸ“˜

If you have a usecase where the entire user base and notifications differ between two distinct business lines within your company, we recommend using different workspaces to manage these notifications effectively. This approach ensures clear separation and management of workflows, templates, and user data, tailored specifically to the unique requirements of each business line.


Sending notifications for a tenant

By default, all notifications (aka workflow) are triggered for default tenant (your organization). You can override tenant by passing tenant_id in your workflow or event instance. Passing tenant_id in your workflow will:

  • Pick tenant properties for sending custom notification content or design for the tenant (by replacing tenant variables in the template).
  • Pick per-tenant preferences while executing the workflow.
  • Override vendor details for the tenant if set. This is especially useful for cases where you are sending notifications on behalf of your customers and they want the notifications to be sent with their email domain and brand handles or you have different customer applications for sending messages on chat applications (Slack and MS Teams).

Below is a sample of how you can override tenant_id in your workflow or event call

from suprsend import Workflow

workflow_body = {...}

# Pass tenant_id in workflow instance
wf = Workflow(body=workflow_body, tenant_id='_tenant_id_')

# Trigger workflow
response = supr_client.trigger_workflow(wf)
print(response)
from suprsend import Event

distinct_id = "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08" 
event_name = "product_purchased"   
properties = {...}
} 

# Pass tenant_id in event instance
event = Event(distinct_id=distinct_id, event_name=event_name, properties=properties, tenant_id = "_tenant_id_")

# Track event
response = supr_client.track_event(event)
print(response)