Articles on: Test

Format campaigns test

This article explains how to format Crisp campaign messages, personalize them with variables, and safely build either Markdown or HTML email content.


Campaigns in Crisp support dynamic variables, which means you can personalize messages with user details such as their name, company, location, or your own custom data. By default, campaigns use Markdown formatting, though you can also switch to HTML when you need a fully custom email layout. Before going live, make sure your contact data is properly synced so your variables resolve as expected.


To send automated campaigns and personalize them reliably, make sure your users already have the relevant data stored in Crisp, such as their email address, name, company, country, or any custom data you plan to reuse.



Formatting campaign messages


Campaign messages can be created in two different formats:


Available formats

  • Markdown → best for simple, fast, and reliable formatting
  • HTML → best for advanced layouts and custom email templates


By default, Campaigns use Markdown formatting. If you need help creating or triggering a campaign first, you can also check how automated campaigns work.



Using Markdown campaigns


Campaigns are formatted with Markdown by default. This is the easiest and safest option if you want your messages to render consistently across email clients without maintaining your own HTML.


Markdown formatting reference


Campaign Markdown uses the same syntax as regular Crisp messages.


If you need a full syntax reference, check our article on formatting Crisp messages.


How variables work


Variables are inserted using the following syntax:


{{ variable_name }}


When Crisp recognizes a variable, it replaces it with the corresponding value for the targeted user. For example, {{ name.first }} may become John. If the value is unknown, it will be replaced with empty text.


If you want to define a fallback when the value is missing, use this format instead:


{{ variable_name | "Fallback text value" }}


If a variable may be missing, using a fallback is strongly recommended. It helps you avoid awkward sentences such as “Hello !” or incomplete links and CTAs.


Available variables


Supported variables

  • Full name{{ name.full }} or {{ name.full | "Fallback Full Name" }}
  • First name{{ name.first }} or {{ name.first | "Fallback First Name" }}
  • Last name{{ name.last }} or {{ name.last | "Fallback Last Name" }}
  • Email{{ email }} or {{ email | "Fallback Email" }}
  • Country{{ country }} or {{ country | "Fallback Country" }}
  • City{{ city }} or {{ city | "Fallback City" }}
  • Website{{ website }} or {{ website | "Fallback Website" }}
  • Company name{{ company.name }} or {{ company.name | "Fallback Company Name" }}
  • Custom data value{{ data.your_key }} or {{ data.your_key | "Fallback Value" }}
  • Custom event data{{ event.data.event_data_key }}


Replace your_key and event_data_key with the actual key names you use in your Crisp setup.


The custom data variable relies on user data already stored in Crisp. You can set that data from your website or app, through the JavaScript SDK, through the HTTP REST API, or manually from https://app.crisp.chat → Contacts.


Good practices for variables


Recommended practices

  • Always add a fallback for optional fields such as city, company, or first name
  • Keep your phrasing natural so the sentence still reads well even if a fallback is used
  • Use custom data for long-term profile data such as plan, account ID, region, or lifecycle stage
  • Use event data for campaign-specific context passed at trigger time


If you need to store long-term customer properties in Crisp, have a look at what custom data is and how to use it. If you need to trigger campaigns from user activity, also check how to push user events.


Markdown examples


Example #1 — variable replacement in links and text

Hello {{ name.full | "there" }}!

In order to complete your subscription, you can visit [this link]({{ event.data.user_dashboard_url }}) to access your dashboard.

You can also consult our latest updates related to your business use-case in [our changelog](https://acme.com/changelog?business-type={{ event.data.user_business | "general" }})


Example #2 — friendly message with fallbacks

Hello {{ name.first | "there" }}, how are you doing?

We noticed you are based in {{ city | "an unknown city" }}, {{ country | "an unknown country" }}. 🙂
Cheers.



Using HTML campaigns


HTML campaigns are useful when you want full control over the design of your email. This is the right option for branded newsletters, more advanced layouts, or reusable email templates.


HTML is more powerful than Markdown, but it also requires more care. Unlike Markdown campaigns, Crisp does not generate or normalize the HTML for you.


A no-code alternative


If you do not want to code your own template, you can use the Crisp WYSIWYG email builder to create and edit HTML email layouts visually.


Required base HTML structure


A valid base HTML structure is required before Crisp lets you save an HTML campaign.


Minimum structure

<html>
<body>
<!-- Your content here -->
</body>
</html>


Trackers in HTML campaigns


Email open tracking and link click tracking are automatically added to HTML campaigns when you send them.


This means you can still measure engagement even when you use your own HTML template.



Any marketing or campaign email must include an unsubscribe link.


Use the following tag to generate it:


{{ url.unsubscribe }}


Example

<a href="{{ url.unsubscribe }}">Unsubscribe from emails</a>


The unsubscribe link is legally required in campaign emails. Crisp will not let you save an HTML campaign if {{ url.unsubscribe }} is missing from a link href attribute.


The unsubscribe link does not work in test campaign emails. Always verify it on real sends only.



Recommendations for HTML campaigns


HTML email rendering can vary a lot from one email client to another. The recommendations below help you reduce compatibility and deliverability issues.


Layout recommendations


Layout best practices

  • Keep your email width under 800 pixels
  • Prefer table-based or simple grid layouts
  • Avoid floating elements such as float: left;
  • Use common cross-platform fonts
  • Do not use JavaScript in email content


HTML structure recommendations


Structure best practices

  • Use a transitional XHTML doctype for broad compatibility
  • Prefer HTML tables to structure the layout
  • Validate your code before sending it


Recommended doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Content here -->
</html>


You can also validate your code with the W3C HTML validator.


CSS recommendations


CSS best practices

  • Centralize your CSS in a single <style> block inside <head>
  • Avoid complex selectors and nested classes
  • Keep styling simple to maximize support across email clients


Deliverability and spam recommendations


Deliverability best practices

  • Test your email before sending at scale
  • Avoid overly promotional wording
  • Avoid flashy colors, heavy visual effects, or aggressive button styles
  • Review your spam score with tools such as Mail Tester


Mobile responsiveness


Responsive email best practices

  • Do not forget mobile clients
  • Use the viewport meta tag
  • Place media queries at the end of your <style> block


Viewport meta tag

<meta name="viewport" content="width=device-width, initial-scale=1" />



Mandatory requirement

  • Every campaign email must include an unsubscribe link in the footer


<a href="{{ url.unsubscribe }}">Unsubscribe from emails</a>


Crisp will refuse to save your template if the unsubscribe tag is missing or not placed in an href attribute.



HTML campaign baseline template


Below is a clean baseline template you can use as a starting point for a custom HTML campaign.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>

<style type="text/css">
body {
background: #EFF3F6;
color: #333333;
margin: 0;
padding: 0;
}

img {
border: 0 none;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
}

a {
color: #000000;
text-decoration: underline;
}

a img {
border: 0 none;
}

table,
td,
tr {
border: 0 none;
border-collapse: separate;
}

td {
vertical-align: middle;
}

ul {
list-style: none;
padding: 0;
}

body {
font-family: "HelveticaNeueLight", "HelveticaNeue-Light", "Helvetica Neue Light", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-stretch: normal;
font-size: 14px;
letter-spacing: .35px;
}
</style>

<title>Email Template</title>
</head>

<body>
<h1>Your content goes there.</h1>

<a href="{{ url.unsubscribe }}">Unsubscribe from emails</a>
</body>
</html>



Related resources


Helpful articles and pages

Updated on: 09/04/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!