Template model
Example
{
"id": 609193,
"type": "plain",
"name": "Christmas",
"wrapper_id": 5913,
"content": { "body": "Hei {{name}}" },
"created_at": "2020-09-15T12:45:08.618Z",
"updated_at": "2020-09-15T12:45:08.618Z"
}
Definition
Key | Type | Required? | Readonly? | Description |
---|---|---|---|---|
id | integer | yes | yes | |
name | string | no | no | |
wrapper_id | integer | no | no | ID of wrapper template |
type | enum: ['plain', 'email', 'bee_email', 'push', 'generic'] | yes | no | |
content | Object | yes | no | Definition depends on the type . See below |
created_at | datetime | yes | yes | Time of creation |
updated_at | datetime | yes | yes | Time of last update |
Types
plain
template
{
"id": 609193,
"wrapper_id": null,
"type": "plain",
"content": { "body": "Hei {{name}}" },
"created_at": "2020-09-15T12:45:08.618Z",
"updated_at": "2020-09-15T12:45:08.618Z"
}
Key | Type | Required? | Readonly? | Description |
---|---|---|---|---|
content.body | string | yes | no |
email
template
email
channel.{
"id": 609194,
"wrapper_id": null,
"type": "email",
"content": { "subject": "Welcome!", "body": "<b>Hei {{name}}</b>", "preheader": "We welcome you" },
"created_at": "2020-09-15T12:45:08.618Z",
"updated_at": "2020-09-15T12:45:08.618Z"
}
Key | Type | Required? | Readonly? | Description |
---|---|---|---|---|
content.body | string (HTML) | yes | no | |
content.subject | string | yes | no | |
content.preheader | string | yes | no | |
content.thumbnail.url | string (URL) | no | yes | Auto-generated preview of the email |
bee_email
template
email
by containing JSON source which is used by Bee Plugin to generate HTML body
.{
"id": 609193,
"wrapper_id": null,
"type": "bee_email",
"content": { "subject": "Welcome!", "body": "<b>Hei {{name}}</b>", "preheader": "We welcome you", "bee_json": {} },
"created_at": "2020-09-15T12:45:08.618Z",
"updated_at": "2020-09-15T12:45:08.618Z"
}
Key | Type | Required? | Readonly? | Description |
---|---|---|---|---|
content.body | string (HTML) | yes | no | |
content.bee_json | object | yes | no | |
content.subject | string | no | no | |
content.preheader | string | no | no | |
content.thumbnail.url | string (URL) | no | yes | Auto-generated preview of the email |
push
template
push
channel.{
"id": 609193,
"wrapper_id": null,
"type": "push",
"content": {
"subject": "Welcome",
"body": "Hi {{name}}!",
"url": "iml://app/cpn",
"data": { "something": "special" },
"android_payload": { "notification_count": 420 },
"ios_payload": { "badge": 33 }
},
"created_at": "2020-09-15T12:45:08.618Z",
"updated_at": "2020-09-15T12:45:08.618Z"
}
Key | Type | Required? | Readonly? | Description |
---|---|---|---|---|
content.body | string (HTML) | yes | no | |
content.subject | string | no | no | |
content.url | string (URL) | no | no | URL to be used by mobile app for redirecting the user |
content.image_url | string (URL) | no | no | URL of image to be displayed within push |
content.data | object | no | no | Additional data to be passed to mobile app |
content.android_payload | object | no | no | Additional android-specific payload see more |
content.ios_payload | object | no | no | Additional ios-specific payload see more |
content.thumbnail.url | string (URL) | no | yes | Auto-generated preview of the email thumbnail |
generic
template
sent with various channels.
{
"id": 609193,
"wrapper_id": null,
"type": "generic",
"content": { "subject": "Welcome", "body": "Hi {{name}}!", "url": "iml://app/cpn" },
"created_at": "2020-09-15T12:45:08.618Z",
"updated_at": "2020-09-15T12:45:08.618Z"
}
Key | Type | Required? | Readonly? | Description |
---|---|---|---|---|
content.body | string (HTML) | yes | no | |
content.subject | string | no | no | |
content.preheader | string | no | no | |
content.url | string (URL) | no | no | URL to be used by mobile app for redirecting the user |
content.image_url | string (URL) | no | no | URL of image to be displayed within push |
content.data | object | no | no | Additional data to be passed to mobile app |
content.android_payload | object | no | no | Additional android-specific payload see more |
content.ios_payload | object | no | no | Additional ios-specific payload see more |
Templating system
it's demonstrated in Example of this section. However, in pushes and SMSes, full set of features is available.
Example: Having this as a body of SMS sent to MPC members
{% if dmp.bonus_points %}
Your points balance is {{ member_bonus_points }}! :)
{% else %}
You have no points :(
{% endif %}
A following text will be received by member that has some points:
Your points balance is 540 :)
A the following text will be received by member that has no points:
You have no points :(
their MPC data may be used as merge-tags:
merge-tag | Description |
---|---|
member_id | |
member_secret_id | Special member's ID of used to authorize member in some MPC services |
member_msisdn | |
member_email | |
member_app_token | |
member_* | Member property (e.g. member_first_name ) - the set depends on LC configuration |
dmp_* | DMP value for member (e.g. dmp_bonus_points ) - available for audience members only, the set depends on LC configuration |
within
properties
may be used - see example.Having arbitrary recipients provided as follows:
[
{ "email": "piotr@example.com", "properties": { "first_name": "Piotr", "some_object": { "points": 15} } },
{ "email": "ola@example.com", "properties": { "first_name": "Ola", "some_object": { "points": 42 } } }
]
A Template's content may be defined this way:
Hello {{ first_name }}.
Your email is {{ email }}.
Your points balance is {{ some_object.points }}.
Template wrapping
Sample wrapper definition:
{
"id": 609193,
"wrapper_id": null,
"type": "generic",
"content": {
"subject": "Important message for {{member_first_name}}",
"body": "Hi {{member_last_name}}! {{content}}",
"url": null // Empty, so it won't be used on wrapping
}
}
Consider this wrapper to be assigned to a template as follows:
{
"id": 609194,
"wrapper_id": 609193,
"type": "push",
"content": {
"subject": "I will be replaced by wrapper, as wrapper has no {{content} defined for this property",
"body": "Your last name is {{member_last_name}}!",
"url": "foo://bar"
}
}
Effectively, following content will be used during sending execution after wrapping and merging:
{
"subject": "Important message for Piotr",
"body": "Hi Piotr! Your last name is Ĺwitlicki!",
"url": "foo://bar"
}
wrapper_id
.of the template will be injected into special
{{ content }}
merge-tag of corresponding wrapper's attribute.template A will be wrapped by Template B, but template B will not be wrapped by Template C.
Template type | Wrappable with |
---|---|
plain | generic , email , bee_email , push , plain |
generic | generic , email , bee_email , push |
email | generic , email , bee_email |
push | generic , push |
bee_email | generic |
Modified at 2024-04-22 22:18:17