Brands are used for personalizing communication on behalf of some other entity/organization.

In SuprSend, Brands are workspace level entity. By default, SuprSend creates a brand with brand_id="default" (representing your organization) in each of your workspaces. You can create more brands using one of our backend SDKs.

Data structure of Brand:

{
	"brand_id": "br-01",
	"brand_name": "Awesome Brand",
	"logo": "https://ik.imagekit.io/l0quatz6utm/suprsend/staging/media/suprsend-only-logo_c8aa27faef118418e8c5bd7b31a1cafc74e09200.png",
	"primary_color": "#ff0000",
	"secondary_color": "#00ff00",
	"tertiary_color": "#0000ff",
	"social_links": {
		"website": "https://suprsend.com",
		"facebook": "",
		"linkedin": "",
		"twitter": "",
		"instagram": "",
		"medium": "",
		"discord": "",
		"telegram": "",
		"youtube": "",
	},
	"properties": {
		"prop1": "value1",
		"prop2": "value2"
	}
}

Field Description:

brand_id (*mandatory)

brand-id can be of max 64 characters. It can contain characters [a-z0-9_-] i.e. alphanumeric characters, _(underscore) and -(hyphen).
brand_id is case-insensitive. Suprsend will first converts brand_id to lowercase before storing it or doing any sort of comparison on it.

brand_name (*mandatory)

Name of the brand

logo (optional)

url of the brand logo

brand colors viz. primary_color, secondary_color, tertiary_color (optional)

brand colors settings are mainly used while designing templates.
If you don't provide any of the colors for the brand, SuprSend will assume you want to use the default values, so color settings will automatically be set to the color settings of default brand.

social_links: (optional)

urls of social media accounts of the brand

While updating a social link, if you pass its value as null, then SuprSend will ignore it. If you really want to remove the value you must the value="" (instead of null)
e.g. If you want to remove social_link url for facebook, you must pass facebook=""
{
"social_links": {
"facebook": ""
}
}

properties:

Custom properties associated with the brand.
Update operation on properties works like upsert on 1st-level keys (i.e. if top level key doesn't already exists, then it will added, otherwise its value will be replace by new value. All other key-value pair will remain unchanged).
e.g
1st update: {"properties": {"k1": "v1", "k2": 1.0}}
2nd update:{"properties": {"k1": "v2", "k3": {"nested_k": "v"}}}
after these 2 updates, value for properties will be
{ "k1": "v2", "k2": 1.0, "k3": { "nested_k": "v" } }

Accessing Brand using suprsend-py-sdk

  1. Upsert brand (Create a new Brand OR Update an existing Brand)
from suprsend import Suprsend,  SuprsendAPIException

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

# prepare brand payload. Documentation for Brand-payload is mentioned below
brand_payload = {...} 

try:
	response = supr_client.brands.upsert(brand_id, brand_payload)
	print(response)
except SuprsendAPIException as ex:
	# Handle exception
	print(ex)
  1. Get brand data
from suprsend import Suprsend,  SuprsendAPIException

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

try:
	response = supr_client.brands.get(brand_id)
	print(response)
except SuprsendAPIException as ex:
	# Handle exception
	print(ex)

Response

{
	"brand_id": "brand-id",
	"brand_name": "Brand Name",
	"logo": "https://logo.url",
	"primary_color": "#ff0000",
	"secondary_color": "#00ff00",
	"tertiary_color": "#0000ff",
	"social_links": {
		"website": "",
		"facebook": "",
		"linkedin": "",
		"twitter": "",
		"instagram": "",
		"medium": "",
		"discord": "",
		"telegram": "",
		"youtube": "",
	},
	"properties": {
		"prop1": "value1",
		"prop2": "value2"
	}
}
  1. Brands list api

By default limit=20 . Value for limit must be < 1000

from suprsend import Suprsend,  SuprsendAPIException

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

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

Response

{
  "meta": {
  	"limit": 20,
    "offset": 0,
    "count": 1
  },
  "results": [
    {
      "brand_id": "brand-id",
      "brand_name": "Brand Name",
      "logo": "https://logo.url",
      "primary_color": "#ff0000",
      "secondary_color": "#00ff00",
      "tertiary_color": "#0000ff",
      "social_links": {
        "website": "",
        "facebook": "",
        "linkedin": "",
        "twitter": "",
        "instagram": "",
        "medium": "",
        "discord": "",
        "telegram": "",
        "youtube": "",
      },
      "properties": {
        "prop1": "value1",
        "prop2": "value2"
      }
    }
  ]
}