Create Message Templates

Templates provide a way to personalize messages with information specific to each member of your audience, like first name, flight number, or order status. You can even pass complicated variables to your template.

When you create a template, you can use handlebars and merge fieldsA variable in your message or template that you want to populate with a personalized value for each member of the audience. Merge fields use handlebar syntax — {{merge_field}}. to insert Dynamic ContentVariable message content using handlebar syntax that you populate at send time. Use dynamic content to personalize messages for each member of your audience. and personalize messages for each individual member of the audience. The Airship interface guides you through the process to create or edit your template much like creating a standard message.

When you’re done, you can reference your template when you create messages, automations, or journeys.


To use email templates for commercial messages, you must include an unsubscribe link. If you do not include an unsubscribe link in your template, your message must have the Transactional option selected.

After you select a template, you can click   and then select Custom HTML to add or remove unsubscribe links to support your message.

  1. Go to Messages » Templates.

  2. Click Create Template.

  3. Select the Template Type. App templates represent the push notification message type for app channels. Select Message Center to create Message Center templates.

  4. Enter a Name and a brief Description to help you identify the template in lists (e.g., “Holiday 2020 - Message Center”), and click Save and continue.

  5. Click Add   to populate the different fields in your template.

    1. Enter information for the field, including variables and [Dynamic ContentVariable message content using handlebar syntax that you populate at send time. Use dynamic content to personalize messages for each member of your audience. ].


      When using handlebars to reference variables, you should define default values for your variables with {{ $def variable_name "default value" }}. The preview represents variables without default values as blank spaces, mimicking the behavior your audience will experience if they receive messages with unpopulated variables.

    2. Click Save after you populate each field.

    3. Repeat this step until you have populated all fields in the template.

  6. Click Save Template.

Use the WYSIWYG Editor for Email, Message Center, and Landing Page Templates

When creating an HTML template for email, Message Center messages, and landing pages, you can write your own custom HTML, or build your message with the WYSIWYG editor.

Airship’s drag-and-drop WYSIWYG editor helps you assemble HTML emails and message center messages without having to write HTML.

The editor produces HTML that is compatible with any email client that accepts HTML emails, making sure that your audience sees the best version of your message. As new versions of Outlook and other clients are released, we make sure both your templates will work with them too.

When working with the WYSIWYG editor, you can choose one of Airship’s default templates to get started, or you can create your own design using a Blank Template. Default templates are fully editable.

In email templates, you can add an HTML version of your message by clicking Add   for HTML Body.

  1. Click Add  .
  2. Select a default layout, or select Blank Template to design your own layout.
  3. Create your message body. See the WYSIWYG Editor Reference for details. The WYSIWYG editor supports merge fields using attributes, custom event properties, etc.
  4. Click Done.

You must fill out the rest of the template fields before you can save it.

Adding Merge Fields and Dynamic Content

You can add merge fields, conditionals, and looping fields in the WYSIWYG editor, making it easier to take advantage of dynamic content.

There are three types of merge fields.

  • Standard fields (with the type set to None) apply to text blocks; when you send a message based on the template, Airship replaces your merge field with the appropriate value.

  • Looping and Conditional fields apply to rows of content in your template. When you send a message, Airship evaluates the condition and determines whether or not to insert or repeat a row of content.


You can also take advantage of looping (#each), conditional (#if), and other advanced handlebarsAirship’s message personalization syntax using double curly braces, more commonly known as {{handlebars}}. Use handlebars to insert variables and conditional logic in messages and templates. within HTML blocks to show or repeat content within a block. However, you cannot apply conditional or looping logic to block-level elements in your template without adding merge fields to your template.

  1. In the editor for your template, click {+}.

  2. Click Create Field to add a new field or   to edit an existing field.

  3. Enter a Field Name. This is the friendly name for this merge field that you’ll see in the visual editor.

  4. Enter the Key Path. This is the path to the variable that you want to use.

    • For Attributes, use the attribute name.
    • For Custom Event Properties, use JSON notation for the property in the event’s properties object that you want to use. For example if you wanted to access from your custom event, you would enter name.
    • For an Inline List, use the column name for your variable.
  5. Select the merge Field Logic. Field logic determines both how you use the field and the conditional options you have when you apply the field.

    • None: Insert the value of the Key Path. You can insert this value into any text block in a template.
    • Conditional: Display a content block if the Key Path is populated (true) or not (false).
    • Loop: Repeat a content block for each item in an array, or display the block depending on whether or not an array is populated.
  6. Click Save.

When you’re done creating merge fields, click   to return to the template editor.

Using Merge Fields in your WYSIWYG Template

The way you use a merge field is dependent on the field type. You can insert standard merge fields (with Field Logic set to None) into any text field in your template.

  1. In your template, select HTML Body.

  2. Select the text field that you want to add your merge field to.

  3. In the text tools, click Merge Fields and select your field. If you don’t see your merge field in the drop-down, you may need to create a new merge field with the Field Type set to None.

Airship adds your merge field with the correct syntax in your text.

Using Looping and Conditional Fields in your WYSIWYG Template

Conditional and Looping merge fields apply at the row level: you use the merge field to determine whether you want to show, hide, or repeat a block of content.

While conditions apply at the row level, you can still use merge fields within your conditional block. If you want to use a field both as a block-level condition and as a value within a block, you should save two merge fields: one to represent the conditional usage of the field, and one with Field Logic set to None.

When you apply a looping merge field to a content block, you can reference the current instance of the loop with the this context. For example, if looping through an array of products in your audience’s shopping cart, you might reference the price for each product in the loop with {{this.price}}.

  1. In your template, select HTML Body.

  2. Select the row you want to apply conditional or looping logic to and click  .

  3. Select the merge field that you want to apply, and then select the logic.

    For conditional merge fields
    • Show if condition is false: Shows the block if the field does not exist, is empty, or is null.
    • Show if condition is true: Shows the block if the field exists and is not an empty string or null value.
    For looping merge fields
    • Repeat for each: Repeat this block for each item in an array.
    • Show if there are none: Show this block if the key path is empty or does not exist.
    • Show if there are any: Show this block if the key path exists and has at least one item in the array.

  4. Click Select.

Actions for Message Center Templates

When creating a Message Center message or template using the WYSIWYG editor, you can assign an action that occurs when a user taps a button in the message. You can also use HandlebarsAirship’s message personalization syntax using double curly braces, more commonly known as {{handlebars}}. Use handlebars to insert variables and conditional logic in messages and templates. to personalize the actions.

Adaptive Link

Adaptive Link opens a mobile wallet pass. Select an Adaptive LinkA mobile wallet pass link that supports templates for both Google Pay and Apple Wallet. When a user taps the link, Airship determines the user’s platform and generates the right pass for the user. from the list.

  • Adaptive links must be configured before they will appear in the actions list. See: Adaptive Links Tutorial.
  • Only adaptive links created in the dashboard will appear in the actions list.
Deep Link

Deep Link opens a screen in your app or website. Select a deep link from the list.

Share Share prompts the user to share your message with apps, social media accounts, and other services. Enter the text you want to accompany the share, including any promotional information, shortened links, hashtags, etc.
Web Page Web Page opens a web page or any valid-device level URL such as App Store or app protocol links. The web page opens in the device’s default browser. Enter a URL.
App Rating Open the system prompt for an App rating.

Click Set a Tag to add or remove tags when a user taps the button.

Add Message Center Preview Lines

Message Center supports a message preview, which is how the message appears as listed in the inbox. In the Visual editor you enter preview Lines 1 and 2 on the Message Center tab. See the steps for Visual editor in Create a Message Center message.

For Message Center messages created with the Interactive editor, you can add preview lines via Custom Keys in the Message Center Options in a composer’s Delivery step.


You must perform some development work before your app can display preview lines in the inbox.

Use com.urbanairship.listing.field1 and com.urbanairship.listing.field2 as keys representing preview lines 1 and 2. In the Value field for each key, enter the text that you want to show on each line of the preview.

Preview and Test Templates

You should test your templates to make sure that messages using the template make sense to your audience. When creating or editing a template containing handlebar syntax, you can enter JSON data representing a member of your audience to test template and any dynamic content statements in it without having to send test messages.

When creating or editing a Custom HTML template:

  1. Click   Preview with sample values.

  2. Enter a JSON object representing a member of your audience. The message preview will show you what your message will look like when populated with data.

  • For non-Automation Templates: Enter a JSON object representative of an audience member. Click Example to see a sample object that can help you format your JSON data. This object mirrors the create_and_send audience object.
  • For Automation Templates: Enter custom event properties representative of an audience member, mirroring the properties object in a custom event.

Sample custom event
    "occurred": "{{event_time}}",
    "user": {
        "named_user_id": "user"
    "body": {
        "name": "purchase",
        "subscribe": true,
        "properties": {
            "customer_name": "user",
            "total": 48,
            "cost_units": "USD",
            "purchase": [
                    "qty": 4,
                    "item": "MLB regulation baseball",
                    "per": "$12",
                    "total": "$48"

Example automation template JSON
    "total": 48,
    "cost_units": "USD",
    "purchase": [
            "qty": 4,
            "item": "MLB regulation baseball",
            "per": "$12",
            "total": "$48"

Send a Templated Message

In the Content step when creating a message, you can select a Template option to invoke a template.


If your template includes an External Data FeedA connection to an external API. When you send a message, Airship uses a response from that API to personalize messages. , you must set the error behavior, and the values of variables in the feed URL, in the Delivery step.

In the API, you can use a template property to invoke a template, either by ID or to personalize your message with HandlebarsAirship’s message personalization syntax using double curly braces, more commonly known as {{handlebars}}. Use handlebars to insert variables and conditional logic in messages and templates. . If you want to reference templates by ID, you must get the ID from Messages » Templates in the Airship dashboard.

Manage Templates

Messages » Templates lists your templates. Templates marked Empty do not have message content; you cannot use Empty templates in messages until you edit and populate them.

  1. Go to Messages » Templates.

  2. Find the template you want to manage. You can search by name, type, or ID.

  3. Click an icon to edit, delete, or copy a template.

  •   to Delete a template.
  •   to Edit a template.
  •   to Duplicate a template.