After clicking Create Token, a window appears, where you can select the type of token to be created.
External Content tokens enable you to personalize your messages using externally stored data, for example, your website. The location of the data is not decisive. Your data can be stored in a database or handled by an application, but it has to be presented to Emarsys through an API in the required format.
External Content personalization requires a configured External Content connection and preset.
Creating an External Content preset
In the Create Token window, click New in the External Content preset line, which opens the Create External Content Preset window.
1. Name your External Content preset. You will have to use this name to reference your preset during token creation, therefore, it is worth using a descriptive name.
2. Select the External Content connection.
Under Set parameters, the previously defined reference fields appear.
3. Set the available parameters, by editing their Type and Value. For more information on the uses of parameters, see Before you start personalizing with External Content.
The following types are available:
-
Contact Field:
Use this type to match your reference field to a field in the Emarsys contact database. This ensures that the right people receive the right value when the personalization token is used. -
Constant:
Use this type to enter a value present in your data sources. By entering a single value, you can filter for that value. In the current example, the customer database has rows for all seasons, but we are only interested in rows with "spring". Therefore, everyone will receive the url corresponding to the “spring” reference value. -
External Event:
Use the external event parameter when you want your personalization token set by data in the JSON file of an external event. The external event parameter has the following values:- Event: Select the relevant event name.
-
Variable: JSON objects can be selected as a variable. These JSON objects need to be created in Content > Personalization > External Data > Create Token. Send the External Events containing these JSON objects with the Activate External Event Trigger API call.
When the external event is triggered, the received objects can be used as a reference field value.
Now, you are ready to create the External Content personalization token.
Creating an External Content token
- Give a descriptive name to your token to make it easier to find it while using a content editor.
- Select the category you want to add the token to. A single token can be used in more than one category. You can also create a new category, for more information, see Creating a token category.
- Select the External Content data preset that will be used for the token. You can select and Edit one of your previous presets or even create a New one.
- Select the response field of the External Content connection defined in the preset that will be used to populate the token.
- This line shows a preview of the token and the Emarsys Scripting Language code that is used for it. This code can be copied and inserted into blocks, too. For more information on ESL, see Emarsys Scripting Language.
The syntax is the following:
{{ external_content.name(reference_field1,reference_field2)[index].response_field }}
Using External Content fields with ESL also requires an already existing External Content connection, but creating an External Content token using the personalization UI is not necessary.
- The item index selects the item to be used from the array.
Please note that the list starts with "0", so this means the first item, "1" denotes the second, "2" the third and so on. Use this option to choose from the values, when your data source return multiple results for an API call.
- Check this box if you want to make sure that the message is not sent out if the personalization token cannot be populated.
- Add a fallback text that will be displayed if the value of the field cannot be obtained for some reason. Using a fallback text and marking the field as a requirement for sending are mutually exclusive.
- Here, you can add the formatting details of the token.
Note the information box about display settings override: this means that the settings you make here can be later overridden if needed at campaign-level.