Skip to Content
Technical Articles
Author's profile photo Will Young

SAP Emarsys API example: Passing Raw HTML Through the API

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: 

  <title>API Exercise 4 Example</title> 
   Exercise 4 - Using the <b>RAW</b> Filter 
   Please find the details of your order below: 

And the JSON, would look like this: 

"key_id": "3", 
"external_id": "", 
   "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!

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.