Preview Fields
Render substitute and markdown fields without a template. Use this for a simple editor that previews a message such as message_body before it is placed in an email template.
Listed substitute paths are rendered with the template language against data, with no HTML escaping. Listed markdown paths are then rendered as CommonMark. A path in both lists is expanded first, then converted to HTML. The response keys are the path strings from the request. Missing paths are omitted.
Nothing is stored or queued.
/emails/fields/preview
/emails/fields/preview
Body Parameters
Values available to substitute and markdown.
Data keys to render as templates. Use this when a value contains {{name}}, {{#if}}, or {{#each}}.
Data keys to render as CommonMark after substitute. Raw HTML in the source is escaped.
Example
curl -X POST https://api.mailcast.io/v1/emails/fields/preview \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"name": "John",
"message_body": "Hi **{{name}}**"
},
"substitute": ["message_body"],
"markdown": ["message_body"]
}'
{
"fields": {
"message_body": "Hi John
"
}
}