Source: https://gitlab-test-org.docs.pageloop.ai/template-creation-inapp

# InApp Templates

Fyno's InApp template editor lets you configure templates for Fyno's InApp service. When you add the **InApp** channel to a template, the **Create your Fyno InApp template** screen opens.

![](assets/inappcreate-v-2-editor.png)

The **InApp Preview** on the right shows the notification panel that comes with the Fyno InApp SDK, with **All** and **Unread** tabs.

> [!INFO]
>
> All links in the preview always open in a new tab, even when **Open in same tab** is selected.

## Create an InApp template

1. **Choose the type**
   | Type        | What it does                                                                        |
   | ----------- | ----------------------------------------------------------------------------------- |
   | **Default** | Notifies users when a new InApp message is sent to them.                            |
   | **Silent**  | Sends or updates InApp messages without triggering a pop-up notification for users. |
2. **Title**

   Enter a title for the notification. It gives users short context about the notification.
3. **Body**

   Enter the main content of the notification. Use the toolbar above the field for bold, italic, strikethrough and code formatting.
4. **Action URL**

   Enter where clicking the notification takes the user. Enter a valid HTTP or HTTPS URL, or a route starting with `/` to route the user within the same path. By default, the link opens in a new tab. Select **Open in same tab** to open it in the same tab.
5. **Attachment Type**

   You can add one attachment to a notification. The URL must be public.
   #### None
   No attachment is added.
   #### Image
   Enter the **Image URL**, or use the upload icon. The image size should not exceed 5MB, and it should be a valid HTTP image URL. Supported file types are jpeg and png.

   ![](assets/inappcreate-v-2-attachment-image.png)
   #### Video
   Enter the **Video URL**. The video size should not exceed 16MB, and it should be a valid HTTP video URL.

   ![](assets/inappcreate-v-2-attachment-video.png)
   #### Document
   Enter the **Document URL**. The file size should not exceed 100MB, and it should be a valid HTTP file URL.

   ![](assets/inappcreate-v-2-attachment-document.png)
6. **Buttons (optional)**

   You can add up to 3 call-to-action buttons. The counter next to **Add** shows how many you've added, for example **Add (0/3)**. Each button has these settings:
   | Setting              | What it does                                                                                                                           |
   | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
   | **Button**           | The title of the button.                                                                                                               |
   | **Primary Button**   | Makes this the primary, highlighted button.                                                                                            |
   | **Link**             | Where the button takes the user. Enter a valid HTTP or HTTPS URL, or a route starting with `/` to route the user within the same path. |
   | **Open in same tab** | By default, the link opens in a new tab. Select this to open it in the same tab.                                                       |
   Use the delete icon to remove a button.
7. **Other Settings (optional)**

   Expand **Other Settings** to configure these fields.

   ![](assets/inappcreate-v-2-other-settings.png)
   | Field                | What it does                                                                                                                                                                                                 |
   | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
   | **Tag**              | Only the latest notification with the same Tag ID is shown in the notification center. Use the same ID to update an existing notification instead of showing a new one. Maximum 64 characters.               |
   | **TTL**              | How long the notification is preserved for delivery if the device is offline. Enter the value in the first field and select the unit of time, such as **Seconds**, in the second.                            |
   | **Label**            | The notification is organized under this label for the recipient.                                                                                                                                            |
   | **Icon URL**         | Overrides the default icon for this template. By default, the icon is the image provided to the SDK, and it is used when this field is empty. The URL must be public. Supported file types are jpeg and png. |
   | **Pin notification** | Pins the notification for the recipient.                                                                                                                                                                     |
   > [!NOTE]
   >
   > **Label** and **Pin notification** are supported only in version **2.0.0-alpha-03** of the InApp React SDK.
8. **Additional Data (optional)**

   Expand **Additional Data** to send extra information with the notification, as JSON.

   ![](assets/inappcreate-v-2-additional-data.png)

   Placeholders in additional data must be inside double quotes, in the format `"{{ }}"`. For example:
   ```json
   {
     "order_id": "{{order_id}}"
   }
   ```

> [!TIP]
>
> To use any user property in your templates, add it in this format: `{{$user.$<user_property>}}`. For example, to add Name as a placeholder from the User profile, add it as `{{$user.$name}}`.

> [!WARNING]
>
> You cannot use only numeric values as placeholder keys.

## How to add dynamic content

You can add dynamic content to your templates using one of the four options below:

- [Placeholders](./template-dynamic-content#placeholders)
- [System Variables](./template-dynamic-content#system-variables)
- [Handlebars](./template-dynamic-content#handlebars)
- [Components](./template-dynamic-content#components)

## How to test an InApp template

Use this feature to test a template thoroughly before including it in any Notification Event. This ensures early detection and resolution of any potential issues, for a seamless user experience.

1. Click **Run Test** at the top right of the template. The **Test InApp template** pop-up opens.

   ![](assets/inappcreate-v-2-test-modal.png)
2. From the dropdown, choose **InApp Recipient** and enter the recipient's details, or choose **Distinct ID** and enter it. **Make sure to enter the distinct\_id of a Test User profile.**
3. In **InApp Integration**, select an InApp integration that is already configured in Fyno.
4. **Auto-fill empty placeholders** (optional, AI assistance): If your template has placeholders with no sample values, Fyno can fill them using AI so you can test the notification. Click **Yes** to let Fyno fill sample values for the empty placeholders.
5. Click **Run Test** to send the InApp notification to the recipient with the selected integration. You see the success or failure message along with a link to the Sent Logs.

## Save and go live

Click **Save** to save the template as a **Test** version. You can save different versions of the template this way. Use **Go Live** when you are ready to move your template to the **Live** version.

> [!NOTE]
>
> If template approvals are enabled in your workspace, **Go Live** needs an additional approval step. Choose from your designated approvers, who review and authorize the template changes. See [Approval flow](./approval-flow) for the steps.
