docs/platform/integrations/email/writing-email-template.mdx
You can create email templates in Novu using the block editor, code editor, or API. Choose the block editor for visual layouts, the code editor for full HTML and LiquidJS control, or submit templates programmatically via the API.
The block editor is a WYSIWYG editor that allows you to create and edit email templates. It has two fields: Subject and Body.
The block editor body is made of blocks. A block can be added by clicking on the plus (+) icon in the top-left corner of the editor or by adding a forward slash (/). In both cases, a menu appears with the list of supported blocks. Click on the desired block to add it to the editor. The menu option next to the plus (+) icon can be used to duplicate or delete the block.
The Email Editor supports the following blocks:
The Custom HTML block allows you to insert raw HTML inside a block editor layout.
{{ ... }}.{% for %} or {% if %}.Use this block when you need inline markup control within a visual layout, but don't require full LiquidJS logic.
The Repeat block is a synonym of the JavaScript for loop. Use the + icon or / to add it. It iterates over an array and renders a block for each item. See the video below for details.
In above video:
{{payload.order.items}} is array of items in the order and can be used to iterate over the itemsthen each item in the iteration has following properties:
{{payload.order.items.name}} is the name of the item{{payload.order.items.price}} is the price of the itemShow block can be used to conditionally show content based on a condition. Use the eye icon to toggle the visibility of the content. Few components supports eye icon. Conditions could be based on subscribr properties, payload variables.
<video autoPlay loop muted playsInline src="/images/workflows/add-notification-content/channels-template-editors/show-block.mp4" />In the image above, the Track your order button is displayed only if a subscriber has the showTracking field set to true in their custom data attributes. Similarly, you can use payload variables to conditionally display content.
The code editor provides a built-in interface for writing raw HTML and embedding LiquidJS expressions directly inside the Novu dashboard. This gives you full control over layout, structure, and rendering beyond the capabilities of Novu's block editor.
The editor supports advanced use cases such as:
To use it:
You can also submit custom HTML email templates via the Novu API. This method supports workflows where you render templates externally and use Novu purely for delivery.
During the sending phase:
This approach works well if you manage your templates in your own systems and want Novu to act as the delivery engine.
When authoring email templates, you can bind dynamic data from the following sources:
| Data source | Description | Available in |
|---|---|---|
| Payload schema | Variables defined in your workflow’s payload schema | Block editor, Code editor and API |
| Subscriber data | Subscriber profile data associated with the recipient | Block editor, Code editor, and API |
| Digest variables | Variables that expose the results of the digest step | Block editor, Code editor, and API |
| Local variables | Variables declared within LiquidJS control structures (for loops, if statements) | Code editor and API only |
Both the block and code editors provide autocomplete as you write:
{{ ... }}) and shows available block types when typing /.{{ ... }}.While editing in the editors, the template preview shows how your email will render with real or mock data.