CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
WillYoung
Advisor
Advisor
In our fourth blog on using placeholders with the Emarsys API, we'll look at passing raw HTML code to populate an email, using the ESL (Emarsys Scripting Language) raw filter. 

Use case 

The use case here is the standard one of sending an order confirmation to a customer which contains the order details.

In this case, the email would be built in an external tool, rather than inside Emarsys, and you want to ONLY trigger the API and use Emarsys for sending the email. In such scenarios, you may even want to send the entire HTML through the API. 

In HTML, this would look like this: 
<html> 
<head>
<title>API Exercise 4 Example</title>
</head>
<body>
<h2>
Exercise 4 - Using the <b>RAW</b> Filter
</h2>
<p>
Please find the details of your order below:
</p>
{{event.deliveryDetails|raw}}
</body>
</html>

And the JSON, would look like this: 
{ 
"key_id": "3",
"external_id": "elston.gunn@emarsys.com",
"data":
{
"deliveryDetails": "<ul><li>Firstname: Elston</li><li>Ordernumber: 12345</li><li> Quantity: 3</li><li> Price: £45.95</li></ul>"
}
}

So we can pass the entire HTML (in this case a simple unordered list with list items) inside the JSON, as one long string. Using the raw filter in the ESL placeholder, this will successfully translate into HTML, which is then correctly parsed.  

The resulting email content would look like this: 


And that’s it – I hope you found it useful!