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

# Creating a Template

A template holds the content Fyno sends for a notification. You can create one template with content for every channel you need, and each channel is edited separately inside the same template.

A template can consist of two types of content:

- **Static Content**: This portion of the template remains consistent for all recipients and contains the core message or design of your notification.
- **Dynamic Content**: This part of the template includes placeholders that are dynamically populated with user-specific information. These placeholders can be mapped to data from your data payload, allowing you to personalize the notification content for each recipient. Examples of dynamic content include customer names, SIP amounts, due dates, and other relevant information. Learn more in [Dynamic Content](./template-dynamic-content).

## Supported channels

A channel needs a template before Fyno can send on it. Templates support the following channels.

| Channel  | Guide                                              |
| -------- | -------------------------------------------------- |
| SMS      | [SMS Templates](./template-creation-sms)           |
| WhatsApp | [WhatsApp Templates](./template-creation-whatsapp) |
| Email    | [Email Templates](./template-creation-email)       |
| Push     | [Push Templates](./template-creation-push)         |
| InApp    | [InApp Templates](./template-creation-inapp)       |
| Voice    | [Voice Templates](./template-creation-voice)       |
| Webpush  | [Web Push Template](./web-push-template)           |
| RCS      | [RCS Template](./rcs-template)                     |
| Slack    | [Slack Template](./template-creation-slack)        |
| Discord  | [Discord Template](./template-creation-discord)    |
| Teams    | [Teams Template](./template-creation-teams)        |

## Create a template

1. **Open the Templates page**

   Go to **Templates → Fyno** and click **Create** in the top right corner.
2. **Name the template**

   Enter a **Name**. Use something your team will recognize, such as `order_shipped` or `sip-payment-reminder`.
3. **Add it to a group (optional)**

   Choose a group from **Add To Group (Optional)** to keep related templates together.
4. **Select channels**

   Select every channel this template should support, or select **Use all channels**. SMS is selected by default. You can add or remove channels later from the editor.
5. **Submit**

   Click **Submit**. The template editor opens with the first channel ready to edit.

![](assets/tplcreate-v-2-create-template-modal.png)

## The template editor

The editor has four areas. The example below shows an SMS channel, but the layout is the same for every channel.

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

#### Header bar

| Element                                | What it does                                                                                               |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **‹ Fyno-Templates**                   | Returns to the Templates page.                                                                             |
| **Template name and version dropdown** | Shows the version you are viewing, for example **v1 (Live)**. Use the dropdown to switch between versions. |
| **Last published**                     | Shows who last took the template live, which version, and when.                                            |
| **History icon**                       | Opens the [change logs](#view-change-logs).                                                                |
| **Go Live**                            | Promotes the current version to Live.                                                                      |
| **Save**                               | Saves your changes as a Test version.                                                                      |

#### Left panel

- **Channels** lists every channel in the template. Click a channel to edit it, or click **Add** to add another channel.
- **Search** finds placeholders, Handlebars helpers, variables, and components by name.
- **Placeholders**, **Handlebars**, **System Variables**, and **Components** hold everything you can insert as [dynamic content](#add-dynamic-content).

#### Content editor

The channel-specific form where you write the message. Its toolbar includes:

- **Reset**, which reverts unsaved changes in this channel.
- **Clear** (eraser icon), which empties the channel's fields.
- **Run Test**, which sends a [test message](#test-a-template) to a real recipient.

#### Preview

A live device preview on the right that shows how the message will appear to the recipient, with sample values filled in for any placeholders.

## Add dynamic content

Dynamic content is written using double curly braces, for example `{{customer_name}}`. At send time, Fyno replaces each one with the matching value. The left panel gives you four sources of dynamic content.

### Placeholders

Placeholders are replaced with values from the `data` payload you send when you trigger a notification.

1. **Open the placeholder editor**

   Click **+** next to **Placeholders** in the left panel.

   ![](assets/tplcreate-v-2-placeholders-panel.png)
2. **Add keys and sample values**

   In the **Form** tab, enter a **Key** and a **Sample value** for each placeholder. Click **Add Key** for more rows, or switch to the **JSON** tab to paste them all at once.

   ![](assets/tplcreate-v-2-placeholders-modal.png)
3. **Save the placeholders**

   Click **Done**. Sample values are only used for the preview and for test sends.
4. **Use them in your content**

   Type the key inside double curly braces wherever you need it, for example `Hi {{name}}, your order {{order_id}} has shipped.`

In the **JSON** tab, sample values look like this:

```json
{
  "name": "Priya",
  "order_id": "ORD-48213",
  "amount": "2,499"
}
```

> [!TIP]
>
> Want short or trackable links? Click **Configure** on the **Shorten and track URLs with Fyno Shorty** banner inside the placeholder editor. See [Fyno Shorty](./url-shortener) for details.

> [!WARNING]
>
> Placeholder keys can contain letters, numbers, periods (`.`), underscores (`_`), and hyphens (`-`). A key cannot be made up of numbers only.

### Handlebars

Handlebars helpers transform values at send time, such as formatting dates, doing arithmetic, changing text case, or showing content only when a condition is true. The editor groups 48 helpers into categories.

![](assets/tplcreate-v-2-handlebars-categories.png)

| Category           | Use it to                                                 |
| ------------------ | --------------------------------------------------------- |
| **Content**        | Insert or repeat blocks of content.                       |
| **Date & Time**    | Format and adjust dates and times.                        |
| **Math**           | Perform arithmetic on numeric values.                     |
| **String**         | Change case, trim, replace, and otherwise transform text. |
| **Compare**        | Check whether values are equal, greater, or smaller.      |
| **Logic Gates**    | Combine conditions with and/or logic.                     |
| **Build Your Own** | Compose your own expression from the helpers above.       |

See [Handlebars](./templates-handlebars) for every helper with examples.

### System Variables

System Variables are values Fyno already knows, so you do not need to send them in your payload.

![](assets/tplcreate-v-2-system-variables.png)

| Group               | What it contains                                                                               |
| ------------------- | ---------------------------------------------------------------------------------------------- |
| **Digest**          | Values for templates sent through a digest in a [workflow](./creating-a-workflow-with-digest). |
| **User Properties** | Properties from the recipient's [user profile](./user-profiles-overview).                      |
| **Subscription**    | Values related to the recipient's subscription preferences.                                    |
| **Verify**          | Values generated by [Fyno Verify](./fyno-verify-otp-link).                                     |

To use a user profile property, follow this format:

| Property type     | Format                  | Example                  |
| ----------------- | ----------------------- | ------------------------ |
| Built-in property | `{{$user.$<property>}}` | `{{$user.$name}}`        |
| Custom property   | `{{$user.<property>}}`  | `{{$user.loyalty_tier}}` |

### Components

Components are reusable building blocks, such as a PDF attachment or a shared header, that you create once and use across templates. Click **+** next to **Components** to add one, then select it to insert it.

![](assets/tplcreate-v-2-components-panel.png)

Learn more in [Components](/components) and [Dynamic Content](./template-dynamic-content).

## Test a template

Send a real message before you attach a template to a notification event, so you can catch problems early.

1. **Click Run Test**

   Open the channel you want to test and click **Run Test** at the top of the content editor.
2. **Choose a recipient**

   Enter the recipient's destination, such as a mobile number or email address, or enter the `distinct_id` of a user profile.
   > [!NOTE]
   >
   > If you use a `distinct_id`, use a **test user profile** so real customers never receive test messages.
3. **Choose a provider**

   Select one of the providers already configured for this channel in your integrations.
4. **Send**

   Click **Test**. Fyno shows whether the send succeeded or failed, along with a link to the [Sent Logs](./sent-logs) entry.

## Save and go live

Every template has **Test** and **Live** versions, so you can work on changes without affecting what your users receive.

| Action      | Result                                                                                      |
| ----------- | ------------------------------------------------------------------------------------------- |
| **Save**    | Saves your changes as a **Test** version. The current Live version keeps sending as before. |
| **Go Live** | Promotes the version you are viewing to **Live**.                                           |

The version dropdown next to the template name shows which version you are viewing, for example **v2 (Test)** or **v1 (Live)**.

> [!WARNING]
>
> When a template goes live, every notification event, workflow, and campaign that uses it starts sending the new Live version immediately. Test before you go live.

## View change logs

Click the **history icon** in the header bar to see every change made to the template. Each entry shows:

- Who made the change.
- Which version was changed.
- The date and time of the change.

## Request approval to go live

If your workspace has **Approval** enabled in security settings (a maker-checker workflow), clicking **Go Live** raises an approval request instead of publishing straight away.

#### As the requester

1. **Click Go Live**

   The **Request Approval** dialog opens.
2. **Choose approvers**

   Open the **Select Approvers** dropdown and select one or more approvers.

   ![](assets/tplcreate-v-2-approval-select-approvers.png)
3. **Add a message and decide when it goes live**

   In **Write a Message**, add a short reason for the request. Select **Go live on approval** to publish automatically once the request is approved. Leave it unselected if you want to publish manually after approval.

   ![](assets/tplcreate-v-2-approval-message.png)
4. **Send the request**

   Click **Request**. The pending request appears at the top of the template page, along with the number of approvals required.

   ![](assets/tplcreate-v-2-approval-pending-banner.png)
5. **Cancel the request (optional)**

   To withdraw the request, click **Cancel Request**, then click **Confirm**.

   ![](assets/tplcreate-v-2-approval-cancel-request.png)

#### As the approver

1. **Get notified**

   You receive an email and an InApp notification for every approval request.
2. **Review the request**

   Open the template to approve or reject the request there, or go to **Approval Requests** in the left navigation to see every pending request.

   ![](assets/60-de-965-approval-request-feature-page.png)

   ![](assets/ba-2-bc-39-pending-request.png)
3. **Approve or reject**

   Select one or more requests and click **Approve** or **Reject**. A rejection reason is required.

Once approved, the version goes live automatically if the requester selected **Go Live on approval**. Otherwise, the requester clicks **Go Live** to publish it. See [Approval Request](./approval-request) for more.

## Next steps

- [SMS Templates](./template-creation-sms)

  Build SMS content with DLT support, encoding, and sender settings.
- [WhatsApp Templates](./template-creation-whatsapp)

  Build template, simple, and interactive WhatsApp messages.
