Skip to content

Snippets

Snippet values used in transactional messages can also be accessed in Dynamic Content functions. Snippets are text fragments, sent along with send transactional message API requests.

Displaying snippet value in email:

// This is 'foo' snippet value: 
${Snippet('foo')}

Using in conditional statements:

<if condition="Snippet('foo') == 'bar'">Snippet foo is bar!</if>

Snippets method always returns data as text (string). If a snippet with given name was not sent in API request, the returned value will be null.

Additional method is available to check if a certain snippet was specified and is not empty. This can be useful for conditional statements:

<if condition="SnippetExists('foo')">
   Snippet foo was specified: ${Snippet('foo')}
</if>

NOTE: For additional information about sending transactional messages with snippets using API, please go to the appropriate ExpertSender API Documentation page.