Skip to main content

Content Templates

Content Templates allow to create a predefined set of templates defining what content will contain the Insight Messages produced by Insight Factory system. Those templates also empower Bank Administrators defining Insight Definitions to inject dynamic content into Insight Messages.

Each Content Template needs to answer following questions:

  • How to render the content that will become a part of Insight Message and delivered through Push or Pull channels?
  • How can this content be personalized in a given Insight Definition?

Content rendering

Content Templates allow to define any form of string based output. Examples of output include:

  • plain text
  • HTML content
  • JSON objects

This will be referred to as Dispatcher Template.

The format of the output should be determined by the content delivery Channels. Thus each Content Template needs to be bound to one or more delivery Channels. For instance it makes sense to reuse the same Content Template for web application push channels as well as for the mobile application push channels. On the other hand using a HTML output for a SMS channel is not a good idea.

Content rendering mechanism provided by Insight Factory is a flexible solution and can be used either to render content that could be directly delivered to end users or serve as input to existing marketing tools.

note

Currently it is not possible to create an Insight Definition which will attempt to define the same content delivery Channel more than once. Such situation is considered to be a human error.

Content Personalization

Administrators can decide which parts of Content Templates can be personalized when creating Insight Definitions. This is done by inserting placeholders inside of the template to render, inserting placeholders has been explained in Insight Messages section.

An example of a Content Template outputting HTML content with placeholders looks as follows:

<h1>{{title}}</h1><p>{{description}}</p><a class=\"action-button\" href=\"{{actionLink}}\">{{actionLinkText}}</a>

The layout of the generated output will be the same for all Insight Definitions using this Content Template. It also allows to personalize following parts: title, description, actionLink and actionLinkText. This will be called the Bank Admin Data Model and will have the form of a json object:

{
"title": "Message title",
"description": "",
"actionLink": "/offers",
"actionLinkText": "See more"
}
note

Values provided in the Bank Admin Data Model will be used as default values when rendering the Content Template in Insight Portal.

Once we have a Bank Admin Data Model we need to instruct Insight Portal how to allow Bank Administrators to personalize the content when managing Insight Definitions. This is done by providing a dynamic form schema using the JsonForms framework.

First we need to define the data schema which defines the Bank Admin Data Model to be shown in the UI (objects, properties, and their types). Note that each placeholder from Bank Admin Data Model has a corresponding property in schema\properties\ collection.

"schema": {
"type": "object",
"properties": {
"title": {
"type": "string",
"title": "Title"
},
"description": {
"type": "string",
"title": "Description"
},
"actionLink": {
"type": "string",
"title": "Action link"
},
"actionLinkText": {
"type": "string",
"title": "Action link text"
}
}
},

Currently supported input types:

Secondly we need to define the UI schema which defines how this data is rendered as a form, e.g. the order of controls, their visibility, and the layout.

"uiSchema": {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/title"
},
{
"type": "Control",
"scope": "#/properties/description",
"options": {
"multi": true,
"rows": 10,
"cols": null
}
},
{
"type": "Control",
"scope": "#/properties/actionLink"
},
{
"type": "Control",
"scope": "#/properties/actionLinkText"
}
]
},
note

Currently only VerticalLayout is supported.

Lastly we can provide a link to an image with a static preview of our Content Template to give our Bank Administrators an example of how this Insight message will be delivered to the end users.

    "preview": {
"imageUrl": "https://meniga.cdn.prismic.io/meniga/f1eb18fc-e00a-47d4-9df9-7775f9869b05_main-hero-3.svg",
"imageAltText": "Widget preview"
}

Those three elements combined together form the Bank Admin Template:

{
"schema": "",
"uiSchema": "",
"preview": ""
}

Once the Content Template has been properly configured Bank Administrators should be able to use it to define their Insight Definitions in Insight Portal.

Content Template usage

Managing Content Templates

Content Templates are defined during the integration phase but can also be added anytime during the Insight Factory system lifetime.

Content Templates can only be added or modified through the Insights Factory database. To do this, add or modify a record in the insightsfactory.content_templates table. You need also to add a reference between the Content Template and the chosen Channels in the insightsfactory.channel_to_content_template table.

Content Template database schema is available here

Content template database model

Content Template attributes

When creating Content Templates following data needs to be provided:

AttributeTypeIs requiredDescription
namenvarchar(128)yesUnique name of the Content Template
content_typenvarchar(128)yesAllows to group Content Templates so it's easier to pick the right Content Template in Insights Portal
dispatcher_templatenvarchar(max)yesThe template containing placeholders listed in bank_admin_data_model. This template will be used to render the final content of the Insight Message
bank_admin_data_modelnvarchar(max)yesJSON describing the data model with available personalization placeholders
bank_admin_templatenvarchar(max)yesJSON describing how to render the Content Template in the Insight Portal when managing Insight Definitions. Consists of JsonForms schema, uiSchema and an optional static image preview

Lastly an association between a Content Template and Channel needs to be created by inserting a new row into insightsfactory.channel_to_content_template table.

Examples

Let's assume we have following content delivery channels available in Insight Factory deployment:

  • sms - a push channel for sending plain text messages to users mobile phones
  • web_feed - a pull channel which displays the Insight Message as a HTML widget
  • crm - a push channel which integrates Insight Factory with an external system

Text message

The sms dispatcher requires only the plain text message. Let's also give our Bank Administrators full control over the contents of the message delivered to users mobile phone.

The Content Template will have a following form:

dispatcher_template
{{message}}
bank_admin_data_model
{
"message": "Content of the SMS sent to the user"
}
bank_admin_template
{
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"title": "SMS message"

}
},
"uiSchema": {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/message"
}
]
},
"preview": null
}

HTML widget

The html channel displays the HTML content rendered by the dispatcher. It also consumes other values apart from the content itself:

  • validTo - date after which this Insight Message should not be displayed to users
  • contentIcon - one of the predefined icons that will be displayed along the widget
  • priority - numeric priority to order multiple insights by priority

The Content Template will have a following form:

dispatcher_template
{
"content": "<h1>{{title}}</h1><p>{{description}}</p><a class=\"action-button\" href=\"{{actionLink}}\">{{actionLinkText}}</a>",
"validTo": "{{validTo}}}",
"contentIcon": "{{contentIcon}}",
"priority": {{priority}}
}
bank_admin_data_model
{
"title": "Message title",
"description": "",
"actionLink": "/offers",
"actionLinkText": "See more",
"validTo": "",
"contentIcon": "notice",
"priority": 10
}
bank_admin_template
{
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string",
"title": "Title"
},
"description": {
"type": "string",
"title": "Description"
},
"actionLink": {
"type": "string",
"title": "Action link"
},
"actionLinkText": {
"type": "string",
"title": "Action link text"
},
"validTo": {
"type": "string",
"format": "date",
"title": "Insight valid to"
},
"contentIcon": {
"type": "string",
"enum": ["notice", "danger", "question"],
"title": "Icon of Insight"
},
"priority": {
"type": "integer",
"title": "Insight priority"
}
}
},
"uiSchema": {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/title"
},
{
"type": "Control",
"scope": "#/properties/description",
"options": {
"multi": true,
"rows": 10,
"cols": null
}
},
{
"type": "Control",
"scope": "#/properties/actionLink"
},
{
"type": "Control",
"scope": "#/properties/actionLinkText"
},
{
"type": "Control",
"scope": "#/properties/validTo"
},
{
"type": "Control",
"scope": "#/properties/contentIcon"
},
{
"type": "Control",
"scope": "#/properties/priority"
}
]
},
"preview": {
"imageUrl": "https://meniga.cdn.prismic.io/meniga/f1eb18fc-e00a-47d4-9df9-7775f9869b05_main-hero-3.svg",
"imageAltText": "Widget preview"
}
}

JSON object

Let's assume that the crm channel is used to notify the external CRM system that a specific Insight has been triggered in Insight Factory. The CRM system API accepts a following contract:

  • eventName - name of the event
  • priority - numeric priority of the event
  • data - a key value collection of Insight related data to be passed to the CRM system

The Content Template will have a following form:

dispatcher_template
{
"eventName": "{{eventName}}",
"priority": {{priority}},
"data": {
{{customData}}
}
}
bank_admin_data_model
{
"eventName": "Frequent traveler",
"priority": 10,
"customData": "{ \"TravelDestination\": \"DE\", \"Frequency\": 13 }"
}
bank_admin_template
{
"schema": {
"type": "object",
"properties": {
"eventName": {
"type": "string",
"title": "Name of the event"
},
"priority": {
"type": "integer",
"title": "Insight priority"
},
"customData": {
"type": "string",
"title": "Custom Data"
}
}
},
"uiSchema": {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/eventName"
},
{
"type": "Control",
"scope": "#/properties/priority"
},
{
"type": "Control",
"scope": "#/properties/customData",
"options": {
"multi": true,
"rows": 10,
"cols": null
}
}
]
},
"preview": null
}

Empty content

Sometimes external systems are interested only in the fact that a certain Insight has been triggered and there is no need to render any content. In such case following Content Template will suffice:

dispatcher_template

bank_admin_data_model
{}
bank_admin_template
{}