> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hightouch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build an in-app template

> An in-app template sets the fields marketers fill in for an in-app message and the data your app receives to show it. Define the fields once with your app developers, then reuse the template in campaigns and journeys.

## Overview

In-app messages appear inside your own iOS or Android app, such as a banner on the home screen or a promotion in a feed. Your app decides how each message looks. Hightouch decides who gets which message, and fills in its content for each recipient.

A template is the agreement between the two. It lists the fields a message carries, such as a headline, an image, and a button label, and gives each field a key. Marketers fill in the fields when they [build a message](https://docs.hightouch.com/native-delivery/in-app/messages.md). Your app reads each value by its key and lays the message out in its own UI.

For example, a template called **Promo banner** might have a `headline` text field, a `hero` image field, and a `cta_label` text field. Your developers build one banner view that reads those three keys. Marketers can then send any number of promo banners from campaigns and journeys without an app release.

Agree on the fields and keys with your app developers before you publish. Changing a key later means changing the app.

## Before you begin

* **Manage settings:** Creating and publishing templates requires the **Manage settings** grant for Delivery. See [Permissions](https://docs.hightouch.com/native-delivery/overview#permissions).
* **Push apps (optional):** To refresh inboxes when Hightouch adds a message, register your apps in **Delivery > Settings > Apps**. See [iOS](https://docs.hightouch.com/native-delivery/in-app/ios.md) and [Android](https://docs.hightouch.com/native-delivery/in-app/android.md).

## Create a template

**1. Start a template**

Go to **[Delivery > Templates](https://app.hightouch.com/native-delivery/templates/in-app-templates?from=docs)**, click the **In-app** tab, and click **Create**.

**2. Name the template**

Enter a **Name**. Hightouch turns it into the template's key, which your app receives with every message: **Promo banner** becomes `promo_banner`. You can't rename a template after you publish it.

**3. Optional: Set a location**

Enter a **Location ID**, such as `home_banner`, to tell your app where messages that use this template appear. Your app can load only the messages for one location, so one placement doesn't show another placement's messages. Click **Create** to open the template.

**4. Optional: Choose apps**

Under **Apps**, select the apps that can receive a silent push when Hightouch adds or removes a message that uses this template. A message can only refresh the apps its template allows. See [Refresh inboxes right away](https://docs.hightouch.com/native-delivery/in-app/messages.md#refresh-inboxes-right-away).

**5. Add fields**

Click **Add fields** and choose a field type. Give each field a **Display name**, which is the label marketers see. Hightouch generates the **Key** from the display name. Click **Edit** next to it to set your own. Drag fields to set the order marketers fill them in.

**6. Publish**

Click **Publish**. The template is now available to anyone building an in-app message.

## Choose field types

Pick the type that matches what your app does with the value. The type decides the control marketers use, the checks Hightouch runs, and the `elementType` your app receives.

| Field type | Marketers fill in | Your app receives |
| - | - | - |
| **Text** | A single line or multiple lines of text | `Text`, with the value in `text` |
| **Number** | A number | `Number`, with the value as text |
| **Select** | One option, or more if you turn on **Allow multiple** | `Select`, with the option's value. Multiple values come joined with a comma and a space. |
| **Toggle** | On or off | `Toggle`, with `true` or `false` as text |
| **Date** | A date, with a time if you turn on **Include time** | `Datetime`, with the value as text and a `timezone` |
| **Image** | An image from your assets, or an image URL | `Asset`, with the URL in `mediaUrl` and an optional caption in `mediaCaption` |

Turn on **Required** for any field your app can't show a message without. Marketers can't activate a campaign or start a journey until every required field has a value or a profile default.

### Set rules for each field

Each type has its own rules, so marketers can't send a value your app can't handle:

* **Text:** Set a **Character limit** to fit your layout, or a **Pattern** (a regular expression) for values like promo codes.
* **Number:** Set a **Minimum** and **Maximum**, or turn on **Integer only**.
* **Select:** Add the options marketers choose from. Marketers see each option's **Label**, and your app receives its **Value**.
* **Date:** Require a date in the future or the past, or set the **Earliest** and **Latest** dates. Choose a **Time zone**: **Recipient's local time**, **Workspace time zone**, or **UTC**. Your app receives the setting with the value, as `user_local`, `workspace`, or `utc`.
* **Image:** Limit the **Allowed formats** to .jpg, .png, .gif, or .svg, require **HTTPS only**, or set an **Aspect ratio** such as 16:9. Turn on **Caption field** to collect alt text. Turn off **Allow external URLs** to limit marketers to images from your assets.

Hightouch checks the aspect ratio when the marketer publishes a message, not while they type.

## Set default values

A default fills a field when the marketer leaves it empty. Use one for values that stay the same across most messages, such as a standard button label.

A default can also come from each recipient's profile. Click the variable icon next to **Default value** and pick a column from your Delivery parent model. If the marketer leaves the field empty, each recipient gets their own value, such as their loyalty tier or their favorite store's image. Profile defaults work on **Number**, single-choice **Select**, **Date**, and **Image** fields. The column type must match the field: for example, a **Date** field needs a date or timestamp column.

If a required field has a profile default and a recipient's column is empty, that recipient doesn't receive the message.

## Let marketers personalize text

On a **Text** field, turn on **Allow personalization variables** to let marketers insert profile values, such as `{{ firstname }}`. Hightouch fills them in for each recipient when it places the message. Text fields without this setting reject personalization. See [Personalize a message](https://docs.hightouch.com/native-delivery/personalization.md).

## Add an HTML preview

An HTML preview shows marketers an approximation of how a message looks in your app while they fill in the fields. Hightouch shows it only to marketers and never sends it to devices, so your app's own layout is still what recipients see.

1. In the **Preview** pane, select **HTML**, then click **Add HTML preview**.
2. Paste or upload HTML that mirrors your app's layout. Insert each field with its key as a Liquid variable, such as `{{ headline }}`, or `{{ hero.url }}` for an image. The **Variables** list shows every key, and you can click one to copy it.
3. Save the preview, then click **Publish** to keep it.

Without a preview, marketers see a list of the fields and their values instead. Select **Form** in the **Preview** pane to see the form marketers fill in.

## Update a template

Each time you publish a template, Hightouch saves a new version, shown as **v2**, **v3**, and so on in the template list. Existing messages keep the version they use, so a change never alters a message that's already running. To move a message to the current version, a marketer changes its template in the message editor, which clears the message's field values.

There's no way to delete a template.

## What your app receives

Your app receives each message as data and renders it with its own views. The message's content holds one element per field, in the template's field order. Each element's `tag` is the field's key. Hightouch leaves out a field with no value and no default, so your app can tell an unset field from an empty one.

For the **Promo banner** template, a message's `content` looks like this:

```json theme={null}
{
  "elements": [
    { "tag": "headline", "elementType": "Text", "text": "20% off this weekend" },
    {
      "tag": "hero",
      "elementType": "Asset",
      "mediaUrl": "https://cdn.example.com/weekend-sale.png",
      "mediaCaption": "A model wearing the new rain jacket"
    },
    { "tag": "cta_label", "elementType": "Text", "text": "Shop the sale" },
    { "tag": "ends_at", "elementType": "Datetime", "text": "2026-11-30T23:59:00", "timezone": "user_local" }
  ]
}
```

Each message also carries the template's Location ID as `locationId`, the template's key as `variantSlug`, and the message's `priority` and `expiresAt`. To read them in your app, see [iOS](https://docs.hightouch.com/native-delivery/in-app/ios.md) and [Android](https://docs.hightouch.com/native-delivery/in-app/android.md).

## Limits

| Item | Limit |
| - | - |
| Fields per template | 50 |
| Field key | 64 characters: lowercase letters, numbers, and underscores, starting with a letter |
| Location ID | 128 characters |
| Options per **Select** field | 100 |
| HTML preview | 10 MB |

## Tips and troubleshooting

### You can't publish the template

Hover over **Publish** to see what's missing. The most common reasons are a field without a display name, two fields with the same key, a **Select** field without options, or an invalid default value. A field with an invalid default shows a warning icon in the field list.

The HTML preview can also block publishing, for example when it uses a variable that isn't one of the template's field keys. Fix the variable, or remove it from the preview.

### A marketer can't find the template

The template picker offers only published templates. Check that you clicked **Publish** after your last edit. If you left the page before publishing, your changes weren't saved.

## Next steps

* [Set up iOS](https://docs.hightouch.com/native-delivery/in-app/ios.md) and [Android](https://docs.hightouch.com/native-delivery/in-app/android.md): your app developers read the fields you defined here.
* [Build an in-app message](https://docs.hightouch.com/native-delivery/in-app/messages.md): fill in the template's fields for a campaign or journey.
