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

# Templates

> Customize notification message content using Markdown and dynamic variables

## Overview

Templates control the text content of notifications. If a trigger has no template assigned, Alius uses a built-in default format. Custom templates let you control exactly what appears in each notification using Markdown and `{{variable}}` placeholders.

***

## Template Types

Each template is scoped to an entity type, which determines which variables are available:

| Type     | Available variables               |
| -------- | --------------------------------- |
| Product  | `product.*`, `product_previous.*` |
| Order    | `order.*`                         |
| Customer | `customer.*`                      |
| Returns  | `returns.*`                       |
| Cart     | `cart.*`                          |

***

## Creating a Template

1. Go to **Templates** in the sidebar.
2. Click **Create Template**.
3. Fill in:
   * **Title** — Name for the template (e.g., "High-value order alert")
   * **Type** — Entity type (Product, Order, Customer, Returns, or Cart)
   * **Content** — The message body using Markdown and variables
4. Click **Save**.

The template is then available in the trigger form's template picker.

***

## Markdown Syntax

Templates support a limited Markdown subset:

| Syntax          | Output                      |
| --------------- | --------------------------- |
| `## Heading`    | Bold heading / header block |
| `**bold text**` | Bold text                   |
| `[label](url)`  | Clickable link              |
| `---`           | Horizontal divider          |
| Plain text      | Rendered as-is              |

Markdown is converted per hub at send time:

* **Slack**: Headings → bold, links → `<url|label>` format, `---` → divider block
* **Email**: Full HTML rendering with inline CSS
* **Telegram**: Headings → `*bold*`, links → Markdown v1 format, `---` → `──────────`

***

## Color Customization

Templates have optional color settings that apply per hub:

| Setting             | Hub      | Description                                     | Default   |
| ------------------- | -------- | ----------------------------------------------- | --------- |
| Email Header Color  | Email    | Background color of the email header bar        | `#008060` |
| Email Link Color    | Email    | Color of hyperlinks in the email body           | `#008060` |
| Telegram Background | Telegram | Background color accent in the Telegram message | `#008060` |

Colors are entered as hex values (e.g., `#FF5733`).

***

## Template Priority

When a notification is sent, Alius resolves the message content in this order:

1. **Linked Template** — If the trigger has a `templateId`, the saved template's content is used.
2. **Inline Message Template** — If the trigger has a custom message stored directly on the trigger record.
3. **Default Template + Conditions** — The built-in default for the entity type, automatically extended with any condition fields from the trigger.
4. **Built-in Formatter** — A fallback that generates a readable summary of what changed.

### Auto-Extension with Condition Fields

When a trigger uses the default template and has conditions configured, the default template is automatically extended to include those condition fields. For example, if your trigger has a condition on `inventoryTotal`, the notification will include:

```
Total Inventory: {{product.inventoryTotal}}
Previous Total Inventory: {{product_previous.inventoryTotal}}
```

***

## Built-in Default Templates

If no custom template is selected, Alius uses these defaults:

**Product Updated:**

```
Product Updated: {{product.title}}

Title:
  Previous: {{product_previous.title}}
  New: {{product.title}}

View Product in Shopify: {{product.adminUrl}}
```

**Order Created:**

```
Order Created: {{order.name}}

Customer: {{order.customerFirstName}} {{order.customerLastName}}
Total: {{order.totalPrice}} {{order.currency}}

View Order in Shopify: {{order.adminUrl}}
```

**Customer Updated:**

```
Customer Updated: {{customer.firstName}} {{customer.lastName}}

Email: {{customer.email}}
Tags: {{customer.tags}}

View Customer in Shopify: {{customer.adminUrl}}
```

**Cart Abandoned:**

```
Cart Abandoned

Customer: {{cart.firstName}} {{cart.lastName}}
Email: {{cart.customerEmail}}
Total: {{cart.totalPrice}} {{cart.currency}}
Items: {{cart.lineItemCount}}

Recovery URL: {{cart.recoveryUrl}}
```

***

## Template Variables Reference

<AccordionGroup>
  <Accordion title="Product Variables">
    Use `product_previous.*` variants for "previous" values in update notifications.

    | Variable                            | Description                             |
    | ----------------------------------- | --------------------------------------- |
    | `{{product.id}}`                    | Product ID                              |
    | `{{product.adminUrl}}`              | Link to product in Shopify Admin        |
    | `{{product.title}}`                 | Product title                           |
    | `{{product.status}}`                | `active`, `draft`, or `archived`        |
    | `{{product.productType}}`           | Product type classification             |
    | `{{product.vendor}}`                | Vendor/manufacturer                     |
    | `{{product.tags}}`                  | Comma-separated tags                    |
    | `{{product.handle}}`                | URL handle                              |
    | `{{product.description}}`           | Product description (HTML)              |
    | `{{product.publishedAt}}`           | Publication date                        |
    | `{{product.publishedScope}}`        | Publication scope                       |
    | `{{product.category}}`              | Shopify product category                |
    | `{{product.isGiftCard}}`            | Whether it's a gift card                |
    | `{{product.requiresSellingPlan}}`   | Whether a selling plan is required      |
    | `{{product.hasOnlyDefaultVariant}}` | Whether only one variant exists         |
    | `{{product.outOfStockVariants}}`    | Whether any variant is out of stock     |
    | `{{product.collections}}`           | Collections the product belongs to      |
    | `{{product.price}}`                 | Product price                           |
    | `{{product.compareAtPrice}}`        | Compare-at price                        |
    | `{{product.unitPrice}}`             | Per-unit price                          |
    | `{{product.costPerItem}}`           | Cost of goods per item                  |
    | `{{product.inventoryTotal}}`        | Total inventory across all variants     |
    | `{{product.requiresShipping}}`      | Whether the product requires shipping   |
    | `{{product.inventoryTracked}}`      | Whether inventory tracking is enabled   |
    | `{{product.taxable}}`               | Whether tax is charged                  |
    | `{{product.seoTitle}}`              | SEO meta title                          |
    | `{{product.seoDescription}}`        | SEO meta description                    |
    | `{{product_previous.*}}`            | All above fields for the previous state |
  </Accordion>

  <Accordion title="Order Variables">
    | Variable                             | Description                       |
    | ------------------------------------ | --------------------------------- |
    | `{{order.id}}`                       | Order ID                          |
    | `{{order.adminUrl}}`                 | Link to order in Shopify Admin    |
    | `{{order.name}}`                     | Order name (e.g., `#1001`)        |
    | `{{order.orderNumber}}`              | Order number                      |
    | `{{order.totalPrice}}`               | Grand total                       |
    | `{{order.subtotalPrice}}`            | Subtotal before tax/shipping      |
    | `{{order.totalDiscounts}}`           | Total discount applied            |
    | `{{order.totalTax}}`                 | Total tax charged                 |
    | `{{order.totalLineItemsPrice}}`      | Sum of all line item prices       |
    | `{{order.totalOutstanding}}`         | Amount remaining to be paid       |
    | `{{order.totalWeight}}`              | Combined item weight              |
    | `{{order.currentTotalPrice}}`        | Current total after edits         |
    | `{{order.currentSubtotalPrice}}`     | Current subtotal after edits      |
    | `{{order.totalTipReceived}}`         | Tip amount                        |
    | `{{order.currency}}`                 | Currency code                     |
    | `{{order.presentmentCurrency}}`      | Display currency                  |
    | `{{order.financialStatus}}`          | Financial status                  |
    | `{{order.fulfillmentStatus}}`        | Fulfillment status                |
    | `{{order.displayFinancialStatus}}`   | Human-readable financial status   |
    | `{{order.displayFulfillmentStatus}}` | Human-readable fulfillment status |
    | `{{order.cancelReason}}`             | Cancellation reason               |
    | `{{order.paymentGatewayNames}}`      | Payment methods used              |
    | `{{order.email}}`                    | Email on the order                |
    | `{{order.phone}}`                    | Phone number on the order         |
    | `{{order.customerId}}`               | Associated customer ID            |
    | `{{order.customerEmail}}`            | Customer's email                  |
    | `{{order.customerFirstName}}`        | Customer's first name             |
    | `{{order.customerLastName}}`         | Customer's last name              |
    | `{{order.customerPhone}}`            | Customer's phone                  |
    | `{{order.buyerAcceptsMarketing}}`    | Marketing opt-in status           |
    | `{{order.locale}}`                   | Customer locale                   |
    | `{{order.landingSite}}`              | Landing page URL                  |
    | `{{order.sourceName}}`               | Order source                      |
    | `{{order.tags}}`                     | Order tags                        |
    | `{{order.note}}`                     | Order notes                       |
    | `{{order.test}}`                     | Whether this is a test order      |
    | `{{order.confirmed}}`                | Whether the order is confirmed    |
    | `{{order.edited}}`                   | Whether the order has been edited |
    | `{{order.taxExempt}}`                | Whether the order is tax exempt   |
    | `{{order.taxesIncluded}}`            | Whether prices include tax        |
    | `{{order.dutiesIncluded}}`           | Whether duties are included       |
    | `{{order.shippingName}}`             | Name on shipping address          |
    | `{{order.shippingAddress1}}`         | Shipping street address           |
    | `{{order.shippingCity}}`             | Shipping city                     |
    | `{{order.shippingProvince}}`         | Shipping province/state           |
    | `{{order.shippingCountry}}`          | Shipping country                  |
    | `{{order.shippingZip}}`              | Shipping postal code              |
    | `{{order.shippingPhone}}`            | Shipping address phone            |
    | `{{order.billingName}}`              | Name on billing address           |
    | `{{order.billingAddress1}}`          | Billing street address            |
    | `{{order.billingCity}}`              | Billing city                      |
    | `{{order.billingProvince}}`          | Billing province/state            |
    | `{{order.billingCountry}}`           | Billing country                   |
    | `{{order.billingZip}}`               | Billing postal code               |
    | `{{order.billingPhone}}`             | Billing address phone             |
  </Accordion>

  <Accordion title="Customer Variables">
    | Variable                               | Description                       |
    | -------------------------------------- | --------------------------------- |
    | `{{customer.id}}`                      | Customer ID                       |
    | `{{customer.adminUrl}}`                | Link to customer in Shopify Admin |
    | `{{customer.email}}`                   | Email address                     |
    | `{{customer.firstName}}`               | First name                        |
    | `{{customer.lastName}}`                | Last name                         |
    | `{{customer.phone}}`                   | Phone number                      |
    | `{{customer.tags}}`                    | Tags                              |
    | `{{customer.locale}}`                  | Locale                            |
    | `{{customer.acceptsMarketing}}`        | Marketing opt-in status           |
    | `{{customer.amountSpent}}`             | Lifetime amount spent             |
    | `{{customer.numberOfOrders}}`          | Lifetime number of orders         |
    | `{{customer.productSubscriberStatus}}` | Subscription status               |
    | `{{customer.taxExemptions}}`           | Tax exemption info                |
  </Accordion>

  <Accordion title="Returns Variables">
    | Variable                        | Description                    |
    | ------------------------------- | ------------------------------ |
    | `{{returns.status}}`            | Current return status          |
    | `{{returns.returnReason}}`      | Reason provided for the return |
    | `{{returns.lineItemCount}}`     | Number of items in the return  |
    | `{{returns.totalRefundAmount}}` | Total refund value             |
    | `{{returns.currency}}`          | Currency code                  |
    | `{{returns.orderId}}`           | ID of the associated order     |
    | `{{returns.customerEmail}}`     | Customer's email address       |
  </Accordion>

  <Accordion title="Cart Abandoned Variables">
    | Variable                 | Description                       |
    | ------------------------ | --------------------------------- |
    | `{{cart.id}}`            | Checkout ID                       |
    | `{{cart.recoveryUrl}}`   | URL to recover the abandoned cart |
    | `{{cart.customerEmail}}` | Customer's email address          |
    | `{{cart.firstName}}`     | Customer's first name             |
    | `{{cart.lastName}}`      | Customer's last name              |
    | `{{cart.totalPrice}}`    | Cart total value                  |
    | `{{cart.currency}}`      | Currency code                     |
    | `{{cart.lineItemCount}}` | Number of items in the cart       |
  </Accordion>
</AccordionGroup>
