Tenants (previously named as brands) are used for whitelabelling notifications, personliazing template content or capturing admin preferences for another entity/organization. Tenants are workspace-level entities and by default, a tenant with tenant_id="default" (representing your organization) is created your workspace. Read more about tenants here.

Create / Update Tenant

from suprsend import Suprsend, SuprsendAPIException

supr_client = Suprsend("workspace_key", "workspace_secret")

# Define tenant ID and prepare tenant payload
tenant_id = "tenant_01"
tenant_payload = {
    "tenant_name": "ABC Company",
    "logo": "https://company_logo_image.png",
    "primary_color": "#ff0000",

# ---- Optional Parameters -------
    "secondary_color": "#00ff00",
    "tertiary_color": "#0000ff",
    "timezone": "America/New_York",
    "blocked_channels": ["email"], # These channels will be skipped for sending notification to recipients when triggering for this tenant. 
    "social_links": {
        "website": "https://suprsend.com",
        "facebook": "",
        "linkedin": "",
        "twitter": "",
        "instagram": "",
        "medium": "",
        "discord": "",
        "telegram": "",
        "youtube": ""
    },
    "embedded_preference_url": "", # In-product Notification centre link for capturing user preferences. 
    "properties": {
        "prop1": "value1",
        "prop2": { "prop3": ["value2"] }
    }
}

try:
    response = supr_client.tenants.upsert(tenant_id, tenant_payload)
    print(response)
except SuprsendAPIException as ex:
    print(ex)
FieldDescription
tenant_id (mandatory)Unique identifier for the tenant (max 64 characters, case insenstive). It can contain characters [a-z0-9_\-] i.e. alphanumeric characters, \_(underscore) and -(hyphen).
tenant_name (*mandatory)Tenant’s display name in a human-readable format
logoLogo URL, used in email headers or on hosted preference page for per-tenant branding.
primary_color, secondary_color, tertiary_colorTenant branding colors - used in template design or hosted preference page for per-tenant branding.
timezoneThe primary timezone for most tenants’ recipients. Used as a fallback when sending notifications in the recipient’s timezone and timezone is not set in recipient profile.
blocked_channelsThese channels will be skipped for sending notification to recipients when triggering for this tenant. Used to apply channel level opt-outs at admin level.
social_linksURLs of the tenant’s social media accounts.
embedded_preference_url
propertiesCustom properties of the tenant like address, to be used in template or workflow.

All properties of the tenant can be referred as {{$brand.prop}} (handlebars) or data\["tenant"\].prop in JSONNET format.

Get Tenant

from suprsend import Suprsend, SuprsendAPIException

supr_client = Suprsend("workspace_key", "workspace_secret")

try:
    response = supr_client.tenants.get("tenant_id")
    print(response)
except SuprsendAPIException as ex:
    print(ex)

List Tenants

By default, limit=20. The maximum value for limit is 1000.

from suprsend import Suprsend, SuprsendAPIException

supr_client = Suprsend("workspace_key", "workspace_secret")

try:
    params = {"limit": 20, "offset": 0}
    response = supr_client.tenants.list(**params)
    print(response)
except SuprsendAPIException as ex:
    print(ex)