Message content integration

You can bring content from other systems into your messages instead of copying and pasting it. This article describes the ways to do it, from simple placeholders to content fetched from your own systems when the message is sent. For contact data integrations, see Integration overview.

 

Personalization with placeholders

Placeholders are the most common way to personalize a message. All you need is up-to-date contact data.

Placeholders in Symplify are written in handlebars. They can fetch contact data and show it in the message, for example "Hello Anna". They can also transform the value, for example show "Gold member" for contacts with more than 100 points in an attribute. See Contact data placeholders.

 

Content added while you edit

Most content is written and edited by hand in the message editor. That gives you full control over the result before you send.

Feed blocks help you by fetching content from another source, for example your website or blog, while you edit the message. After you add a feed block, you can edit the imported content like any other content.

  • Predefined feed blocks fetch a set number of articles or items with a given layout.
  • Searchable feed blocks let you search for specific articles or items while you edit.

The source data should be JSON, RSS or structured XML. Contact your Customer Success Manager to set up feed blocks.

 

Content fetched when the message is sent

Dynamic content is fetched for each contact when the message is sent. Use it when the content must be as current as possible, for example stock levels or the opening hours of the contact's nearest store.

 

Prepare your data

  • Publish the data on a URL that Symplify can reach. The URL can't be password protected. To keep the data private, allow only Symplify's IP addresses. Contact support for the list.
  • Return the data as JSON. XML is still supported for backwards compatibility, but JSON is recommended.
  • Symplify caches the response for each URL for a short time. If many contacts share the same values, for example the same city, only one request is sent for them. Structure your URLs so that contacts with the same needs share a URL, to keep the load on your system down.

 

Fetch the data with dynamicHttp

A normal placeholder, such as {{contact.firstName}}, uses the contact's own data. To fetch data from another system, use the {{#dynamicHttp}} helper. Add contact placeholders to the URL, and the response can be used to build the content of the block. For all helpers, see the Handlebars rundown.

The syntax is:

{{#dynamicHttp "https://yoursite.com/..." true true}}
Content built from the response
{{else}}
Default content
{{/dynamicHttp}}

The two true/false values decide what happens if the request fails or returns data that can't be used:

  • The first value applies to the sent message. With true, the message is sent with the default content. With false, the message isn't sent to that contact.
  • The second value applies to the web version of the message (the "view in browser" link). With true, the web version shows the default content. With false, the web version can't be shown.

 

If you leave the values out, both are true.

Add the code to a snippet, and place the snippet in the message where the content should be shown.

 

Example

This example shows the opening hours of the store in the contact's city. The contact's city attribute is added to the URL:

{{#dynamicHttp "https://api.nordicoutdoor.example/stores?city={{contact.city}}" true true}}
{{#if store}}
Your nearest store is {{store.name}}, open {{store.openingHours}} today.
{{else}}
Find your nearest store on our website.
{{/if}}
{{else}}
Find your nearest store on our website.
{{/dynamicHttp}}

The response in this example looks like this:

{
  "store": {
    "name": "Nordic Outdoor Stockholm",
    "openingHours": "10–19"
  }
}

Use dot notation to reach any value in the response, for example {{store.name}}. For a list, use {{#each}}, and for a value in a list, use an index, for example {{items.[0].name}}. If the response is a JSON array rather than an object, it is available as dataAsArray:

{{#each dataAsArray}}{{name}} {{/each}}

The {{else}} inside the {{#if}} is used when the response has no store. The {{else}} of {{#dynamicHttp}} is used when the request or the rendering fails.

 

XML and XSL (legacy)

Older integrations fetch XML or RSS and turn it into HTML with an XSL stylesheet, using the {{dynamicRss}} helper. This method is only kept for backwards compatibility. Use {{#dynamicHttp}} with JSON for new integrations. If you have an XSL integration and need help with it, contact support@symplify.com.

 

Related articles

Was this article helpful?
0 out of 0 found this helpful