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

# Web Push Templates

Fyno's web push templates let you create notifications for both desktop and mobile web, across Windows and macOS devices.

![](assets/webpush-template-creation.png)

## Create a web push template

1. **Title (optional)**

   Enter the title of the notification. It helps summarize the notification and give it context.
2. **Message Content**

   Enter the body of the notification. This is a required field.
3. **Icon URL**

   Enter the URL of the icon to show on the notification, or upload an image. This is usually your brand logo. This is a required field.
   > [!TIP]
   >
   > Use an icon with a 1:1 ratio.
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.
5. **Action Buttons (optional)**

   You can add up to 3 action buttons. Each button has these settings:
   | Setting          | What it does                                                                                                                                                                                   |
   | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | **Button Title** | The name of the button.                                                                                                                                                                        |
   | **Link**         | Where clicking the button takes the user. Enter a valid HTTP or HTTPS URL, such as `https://www.myntra.com/cart?product-id=123`, or a route starting with `/`, such as `/cart?product-id=123`. |
   | **Icon**         | The button icon, in the format `/img/icon.png`.                                                                                                                                                |
   > [!NOTE]
   >
   > The button icon isn't shown in the preview, but it appears in the actual notification.
6. **Other Settings (optional)**
   | Field               | What it does                                                                                                                                                           |
   | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | **Tag**             | Only one notification with the same ID is shown on the device. Use the same ID to update an existing notification instead of showing a new one. Maximum 64 characters. |
   | **Image**           | An image to send with the notification. Enter the image link, or upload an image. Supported file formats are JPG, JPEG and PNG, for desktop and mobile web.            |
   | **Time to Live**    | How long the push message is preserved for delivery if the device is offline or because of OEM device restrictions. The default is 259,200 seconds (3 days).           |
   | **Additional Data** | Extra information sent with the notification, which can be used to render something on the device.                                                                     |
   > [!TIP]
   >
   > **Image recommendations**
   >
   > Keep images under 1MB, with a 2:3 ratio.

## Preview

The **Web Push Preview** on the right shows the notification at device level. You can switch between the two supported devices:

- macOS
- Windows

![](assets/webpush-template-devices.png)

## 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 a web push 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 Webpush template** pop-up opens.

   ![](assets/webpushcreate-v-2-test-modal.png)
2. From the dropdown, choose **Webpush Token** and enter the recipient's web push token, or choose **Distinct ID** and enter it. **Make sure to enter the distinct\_id of a Test User profile.**
3. In **Webpush Integration**, select a web push 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 web push 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.
