JSONPath Expressions
JSON paths and variables allow you to insert data supplied in the Courier Notification Context into your notifications.
Structure of the Courier Notification Context
The Courier Notification Context object has the following structure:
Courier Notification Context
{
"data": { ... },
"profile": { ... },
"tenant": { ... },
"brand": { ... }
}
data
: An object passed to thesend
methodprofile
: An object containing merged profile data from thesend
method and stored in Couriertenant
: An object containing information about the tenant, such as the company name and other settingsbrand
: An object containing branding information, such as colors, logos, and social media links
Accessing Data using JSONPath Expressions
To access data from the Courier Notification Context, you can use JSONPath expressions. JSONPath is a query language that allows you to extract data from JSON objects using a simple and intuitive syntax.
Here are some examples of how to access data from the Courier Notification Context using JSONPath:
- To access a property from the Data object:
$.profile.someProp
ordata.someProp
orsomeProp
. Courier will automatically query the data object for any path not prefixed with$.data
- To access a property from the Profile object:
$.profile.someProp
orprofile.someProp
- To access a property from the Tenant object:
$.tenant.someProp
ortenant.someProp
- To access a property from the Brand settings object:
$.brand.someProp
orbrand.someProp
Brand Settings Object
{
id: string;
colors: {
primary: string;
secondary: string;
tertiary: string;
};
inapp: {
borderRadius: string;
disableMessageIcon: boolean;
placement: "top" | "bottom" | "left" | "right";
emptyState: {
textColor: string;
text: string;
};
icons: {
bell: string;
message: string;
};
};
email: {
header: {
barColor: string;
logo: {
href: string;
image: string;
};
};
};
social: {
facebook?: string;
instagram?: string;
linkedin?: string;
medium?: string;
twitter?: string;
};
}