Snippets are smaller custom pieces of jinja, code, text, or HTML that can be saved and reused across campaigns. Their use can range from saving frequently used Jinja macros, to saving snippets of text, such as the unsubscription sentence that you use in all your SMS campaigns. Similar to HTML blocks or Custom rows, all Snippets are saved within the Asset Manager.



Snippets are currently supported within Email campaigns, Scenarios (SMS content, webhooks, browser and mobile push content, wait node...), Blocks and Custom rows.

Snippets are not supported in: Web layers, in-app messages, Experiments, Tags. Note that we will be adding support for all campaign types in the future.

Creating a snippet

You can create a new snippet in three ways; via Asset Manager, from a campaign or a scenario node directly, or get a headstart with one of our Predefined Templates.

In the Asset Manager, you can click on the New Snippet button at the top of the screen. This will open up the code editor. In a campaign or scenario node, click a (+) button at the bottom of the editor or node modal, selecting Snippet in the asset selector and choosing the “New Snippet” option. As a starting point, you can also choose from different Predefined Templates ranging from simple personalization, price formatting to Jinja syntax examples. Learn more about our Predefined Templates.

Snippet editor

Regardless of the way you go about creating a new snippet, clicking on the New Snippet button will open up a code editor with a Parameters tab on the right. The editor is where you will write the content of the snippet. That can be anything, ranging from plain text to Jinja macros or HTML code.

At any point, you can preview the snippet by clicking on the Test tab. This will allow you to select a specific customer to preview the snippet on, and specify the available parameters.

Using parameters

You can use the Parameters tab to add new parameters (i.e. variable values that you can specify in each individual campaign).

When adding a new parameter, you will have to define its reference, type, and default value, and choose whether the parameter is required or add a tooltip.

  1. Parameter reference is the reference to the parameter that is used in the code. The parameters display name is derived from it.
  2. Parameter type is the data type of the parameter. Available data types include string, text, number, boolean, list, object, datetime, date, time, color, enum, image.
  3. Default value is the default parameter value that will be used if no specific parameter value is provided upon snippet usage in a campaign.
  4. Required defines whether the parameter must be filled in when using the snippet. Parameters marked as required must be filled in unless the default value is also used.
  5. Tooltip will be displayed by the parameter name when inputting the parameters values in campaign.

Alternatively, you can define the parameters directly in the code and add them using the button “Load parameters from the code editor”.

Parameters can be used within the code as standard Jinja variables using the keyword params and the defined reference name e.g:

{{ params.parameterName }} or {{ params["parameter name"] }}

{% set otherVariable = params.parameterName %}

{% if param.paramName = "something" %}

{% endif %}

Multi-word parameter references can only be used with the params[""] notation.

Using Jinja as a parameter

You can also use simple jinja variables/expressions as parameters of snippets. However please note that parameters can not contain complicated jinja expressions within {%... %} or strings containing jinja within {%... %} such as set, if, for loop, etc.

Contextual variables such as event, webhook, email.view are not available directly in the snippets but can be used as parameters in campaigns where those variables are available.


There are two types of notation of jinja variables as parameters depending on their usage.

(1) When using snippets as the jinja reference, the variables must be used directly (without {{ }}), for example:

{{ snippet("<snippet id>", {"purchasePrice": event.total_price }) }}
{{ snippet("<snippet id>", {"finishDate": ((time + 604800) | from_timestamp('%d-%m-%y') ) }) }}
{{ snippet("<snippet id>", {"products": [1,2,3] }) }}

Strings containing jinja personalization must be created using ~, otherwise, they would not be rendered:

{{ snippet("<snippet id>", {"mainText": "Hello" ~ customer.first_name ~ ", welcome!" }) }}

(2) When filling in the parameters via inputs in the asset picker, you need to use the {{ }} notation so that Exponea can recognize the variable and generate the reference correctly, e.g without “”.

In the parameters inputs, it's also possible to input a string containing jinja and it will be automatically translated into the ~ notation. For example, the following parameters inputs:

will be translate into this reference:

{{ snippet('606321bfe04f9d2be61e0812', {'purchasePrice': event.total_price, 'mainText': 'Hello '~ (customer.first_name) ~', welcome!', 'fallbackValue': customer.last_name}) }}

Using snippets in a campaign

Snippets can be accessed from within supported campaigns via the (+) button at the bottom right of the screen. This button will open a modal with the asset picker for snippets and blocks. Clicking on Snippets will load available snippets from the Asset Manager. Note that if the campaign is a part of an initiative, it will only show assets from the same initiative, or assets marked as Global objects.

Selecting a snippet will open the snippet preview with a customer selector, snippet description, and the parameters inputs. When entering the parameters, the preview will be regenerated once you stop inputting values (click outside).


The language variant of the snippet will be selected based on the selected main campaign template language version.

Insert options

After selecting and configuring the snippet, there are two ways of inserting the snippet into your campaign.

(1) Copy as reference

This will copy the reference to the snippet as a jinja tag that can be pasted into code. This will not allow changes to the snippet directly in the campaign and WILL be updated when the snippet is changed.

Referencing a snippet using Jinja:

  1. Without parameters: {{ snippet("<snippet id>") }}
  2. With parameters: {{ snippet("<snippet id>", {"<param name>": <param value>, "<param name>": <param value> }) }}

(2) Copy as code

This will take the full snippet content from the default language template and copy it to the clipboard. The client can simply paste the code into the desired campaign part. This code can be changed as desired, but will NOT be updated when the snippet is changed, neither will it consider language variants.

This option is only available for snippets without parameters.


  • Max snippet template size per translation is 10kB
  • Max 30 distinct translations per snippet
  • Max 20 of distinct snippets being used in a single campaign template/block
  • Max 20 distinct parameters can be created per snippet
  • Max length 100 characters of a parameter name or category
  • Max length 1000 characters for parameter tool-tip

Updated 2 months ago


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.

We rely on cookies

to optimize our communication and to enhance your customer experience. By clicking on the Accept and Close button, you agree to the collection of cookies. You can also adjust your preferences by clicking on Manage Preferences. For more information please see our Privacy policy.

Manage cookies
Accept & close

Cookies preferences

Accept & close