Using (REST-API) tokens in template mails with newlines or HTML tags?

@imog @khalid_zamer

I am reading in content in markdown, convert to HTML, then need to pass that into a Mautic segment email. I set up an API call (also within n8n) to create a new segment/list email. It seems to work although not 100% correctly.

If I pass the full email HTML through the “customHtml” item in the JSON to Mautic, the request fails. If I encode the HTML, it works and builds the HTML correctly in Mautic.

So my question is: How do I encode this HTML programmatically?

EDIT: I started a new thread on this here.

EP