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

In SuprSend, Brands are workspace level entities. 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 convert 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 color 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)
example: If you want to remove the 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 exist, then it will be added, otherwise its value will be replaced by the new value. All other key-value pairs will remain unchanged).

example:
1st update: {"properties": {"k1": "v1", "k2": 1.0}}
2nd update:{"properties": {"k1": "v2", "k3": {"nested_k": "v"}}}
after these 2 updates, the value of properties will be { "k1": "v2", "k2": 1.0, "k3": { "nested_k": "v" } }


Accessing Brand using suprsend-node-sdk

  1. Upsert brand (Create a new Brand OR Update an existing Brand)
const { Suprsend } = require("@suprsend/node-sdk");

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

// prepare brand payload. Documentation for Brand-payload is mentioned below
brand_payload = {...} 
                 
const response = supr_client.brands.upsert(brand_id, brand_payload); // returns promise
response.then((res) => console.log("response", res));
  1. Get brand data
const { Suprsend } = require("@suprsend/node-sdk");

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

response = supr_client.brands.get(brand_id)// returns promise
response.then((res) => console.log("response", res));
	

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

const { Suprsend } = require("@suprsend/node-sdk");

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

const response= supr_client.brands.list({limit:20, offset:0});
response.then((res) => console.log("response", res));

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"
      }
    }
  ]
}


Adding brands in Trigger workflow method

const { Workflow } = require("@suprsend/node-sdk")

const supr_client = new Suprsend(
  "_workspace_key_",
  "_workspace_secret_",

);

// Prepare Workflow body
const workflow_body = {...}
   
const wf = new Workflow(workflow_body, {brand_id :  "_brand_id_"})
                       
// Trigger workflow
const response = supr_client.trigger_workflow(wf); // returns promise
response.then((res) => console.log("response", res));


Adding brands in Track event method

const { Event } = require("@suprsend/node-sdk");

const supr_client = new Suprsend(
  "_workspace_key_",
  "_workspace_secret_",

);

const distinct_id = "_distinct_id_"
const event_name = "_event_name_"

const properties = {...}

const event = new Event(distinct_id, event_name, properties, {brand_id :  "_brand_id_"})
const response = supr_client.track_event(event)
response.then((res) => console.log("response", res));