Message templates

Messages templates can be defined to be used with Action Rules. Pilvi™ provides a default set of templates for you to get started with, but you can modify the templates to your liking or create new templates.

Syntax

Message templates use the Mustache syntax

Variables are used by wrapping them in double-braces

<p>{{company.name}}</p>

List variables are indicated with square brackets [] at the end of variable name. For ex. a list variable of profile's properties is profile.properties[]

You can loop through the list variable by using a Section. Section starts with a # and ends with a /.

<ul>
{{#profile.properties}}
    <li>{{label}}: {{value}}</li>
{{/profile.properties}}
</ul>

If a value isn't available for a certain variable, you can use inverted section to render a section instead.

In the example below, row 3 is rendered if the variable value contains a value. If not, then row 4 is rendered instead:

1: <ul>
2: {{#profile.properties}}
3:      {{#value}}<li>{{label}}: {{{value}}}</li>{{/value}}
4:      {{^value}}<li>{{label}}: Placeholder text</li>{{/value}}
5: {{/profile.properties}}
6: </ul>

Note properties[].value needs to be wrapped in triple-braces so the HTML is properly rendered for all Property value types.

Variable availability varies between messsage template types. Available contexts define which variables are available.

Localization

Each template can be localized for available languages.

The locale in which the emails are sent, are chosen dynamically based on the

  • language that the customer is currently using on the Shop/Console/Manager.
  • or by a user specific language value, in cases where the email sending originates from a background process where it doesn't relate to any UI action.
  • fall back to Site default value DEFAULT_LOCALE_CODE (usually English)

Templates

Message Template Type Context
USER User
PROFILE User Profile
SERVICES_EXPIRING User Profile
SERVICE User Profile Service
SERVICE_CANCELED User Profile Service
SERVICE_EXPIRED_BECAUSE_UNPAID User Profile Service
SERVICE_EXPIRED_BECAUSE_CANCELED User Profile Service
CUSTOMER_ORDER_CONFIRMATION User Profile Order
SELLER_ORDER_CONFIRMATION User Profile Order
INVOICE_PAYMENT_SUCCESSFUL Profile Invoice Payment
INVOICE_PAYMENT_FAILED Profile Invoice Payment
INVOICE User Profile Invoice Payment
INVOICE_CREATED Profile Invoice Payment
INVOICE_REMINDER Profile Invoice Payment
INVOICE_OVERDUE Profile Invoice Payment

System templates

System message templates are tied to critical processes of the Pilvi™ platform. Multiple versions of these templates cannot be created.

Message Template Type Context
SERVICE_EMAIL_PROVISION Profile Service

Variables

All templates

Variable Name Description / Value source
company.name Preference: COMPANY_NAME
company.email Preference: COMPANY_EMAIL
company.address Preference: COMPANY_ADDRESS
company.zipcode Preference: COMPANY_ZIP_CODE
company.city Preference: COMPANY_CITY
company.country Preference: COMPANY_COUNTRY
company.phone Preference: COMPANY_PHONE
company.site.url Preference: COMPANY_SITE_URL
company.logo.url Preference: COMPANY_LOGO_URL
company.vat.id Preference: COMPANY_VAT_ID
message.title Title/Subject of the message template
site.name Site name. My Shop
site.console.url Site Console Root URL. ex. my-shop.saas.pilvi.com/console
site.console.profile.url Site Console Profile Page URL. ex. my-shop.saas.pilvi.com/console/profile
site.console.invoices.url Site Console Invoices Page URL. ex. my-shop.saas.pilvi.com/console/invoices
site.console.services.url Site Console Services Page URL. ex. my-shop.saas.pilvi.com/console/services
site.manager.url Site Manager URL. ex. my-shop.saas.pilvi.com/manager
site.domain Site's domain ex. my-shop.saas.pilvi.com
site.shop.url Site's shop url ex. my-shop.saas.pilvi.com
year Current year

Template specific

Message Template Type Variable Name Description / Value source
SERVICES_EXPIRING numberofdaysbeforeexpire Days before Service Expiration Date (prev. numberofdaysbeforeexpire)
SERVICES_EXPIRING expiringservices List of expiring services. Contains same variables as Service context
INVOICE_REMINDER numberofdaysbeforeduedate Days before Invoice Due Date
INVOICE_OVERDUE numberofdaysafterduedate Days after Invoice Due Date

User context

Variable Name Description / Value source
user.id User Id
user.email User Email
user.name User Full Name
user.firstname User Firstname
user.lastname User Lastname

Profile context

Variable Name Description / Value source
profile.id Profile Id
profile.no Profile No
profile.name Profile Name
profile.balance Profile Balance
profile.debt Profile Debt
profile.address.delivery.street Profile Delivery Address Street
profile.address.delivery.city Profile Delivery City
profile.address.delivery.zipcode Profile Delivery Zip Code
profile.address.delivery.state Profile Delivery State
profile.address.delivery.country Profile Delivery Country
profile.address.invoice.street Profile Invoice Address Street
profile.address.invoice.city Profile Invoice City
profile.address.invoice.zipcode Profile Invoice Zip Code
profile.address.invoice.state Profile Invoice State
profile.address.invoice.country Profile Invoice Country
profile.services List of active Services on the Profile. Contains same variables as Service context
profile.vatnumber Profile VAT Number
profile.einvoiceovt Profile Electronic Invoice address (OVT)
profile.properties[].name Profile Property Name
profile.properties[].label Profile Property Label
profile.properties[].value Profile Property Value

Service context

Variable Name Description / Value source
service.id Service Id
service.no Service No
service.name Service Name
service.url Service Page URL
service.expiredate Service Expiration Date
service.properties[].name Service Property Name
service.properties[].label Service Property Label
service.properties[].value Service Property Value
service.product The Product of the Service. Contains same variables as Product context

Order context

Variable Name Description / Value source
order.id Order ID
order.no Order Number
order.created Order creation time, localized
order.subtotal Order Subtotal, the price of the products ordered
order.balanceconsumed The amount of account balance consumed
order.total Order Total. The total price of the order after reductions such as discounts, account balance use
order.totalwithvat Order Total With VAT
order.vat.rate Order VAT Rate
order.vat.amount Order VAT Amount
order.reference Customer reference
order.additionalinfo Order additional info
order.products List of Products in Order. Contains same variables as Product context
order.invoice Invoice from Order. Contains same variables as Invoice context

Contract context

Variable Name Description / Value source
contract.id Contract ID
contract.no Contract Number
contract.startdate Contract start date
contract.invoicedtill Contract invoiced till date
contract.paidtill Contract paid till date
contract.reference Contract customer referenced
contract.created Contract creation time, localized

Product context

Variable Name Description / Value source Format
product.id Product Id number
product.no Product Number number
product.name Product Name string
product.plan Product Plan string
product.image.url Product Image URL string
product.productgroup.name Product Group Name string
product.properties[].name Product Property Name string
product.properties[].label Product Property Label string
product.properties[].value Product Property Value string
product.billingperiod Product Billing Period 1 month
product.billingprice Product Billing Price (price * billingperiod) 0.00
product.billingpricewithvat Product Billing VAT Price (price * billingperiod) 0.00
product.trialperiod Product Trial Period 1 month
product.price Product Price (price in product price interval) 0.00
product.priceperiod Product Price Period 1 month
product.pricewithvat Product VAT Price 0.00

Invoice context

Variable Name Description / Value source Format
invoice.id Invoice Id number
invoice.no Invoice Number number
invoice.issuedate Invoice Issue Date date, localized
invoice.duedate Invoice Due Date date, localized
invoice.sum Invoice Sum In Base Currency 0.00
invoice.sumvat Invoice Sum With VAT In Currency 0.00
invoice.sumopen Invoice Sum Open 0.00
invoice.sumopenvat Invoice Sum Open With VAT In Base Currency 0.00
invoice.referenceno Invoice Reference Number string
invoice.customerreference Invoice Customer Reference Number string
invoice.items[].id InvoiceItem Id number
invoice.items[].name Product name from invoiced service created string
invoice.items[].description InvoiceItem Description string
invoice.items[].service.id InvoiceItem Service Id number
invoice.items[].multiplier InvoiceItem Billing Interval Multiplier number
invoice.items[].price InvoiceItem Price number
invoice.items[].sum InvoiceItem Sum number
invoice.items[].sumvat InvoiceItem Sum VAT number
invoice.items[].unit InvoiceItem Billing Interval Unit string
invoice.items[].recurring InvoiceItem Recurring Service boolean
invoice.items[].vatrate InvoiceItem VAT Rate number
invoice.items[].vatamount InvoiceItem VAT Amount number
invoice.items[].billingperiodstart Billing Period Start Date date
invoice.items[].billingperiodend Billing Period End Date date
invoice.address.seller.street Invoice Seller Address Street string
invoice.address.seller.city Invoice Seller City string
invoice.address.seller.zipcode Invoice Seller Zip Code string
invoice.address.seller.state Invoice Seller State Name string
invoice.address.seller.country Invoice Seller Country Name string
invoice.address.invoice.street Invoice Address Street string
invoice.address.invoice.city Invoice Address City string
invoice.address.invoice.zipcode Invoice Address Zip Code string
invoice.address.invoice.state Invoice Address State Name string
invoice.address.invoice.country Invoice Seller Country Name string
invoice.address.delivery.street Invoice Delivery Address Street string
invoice.address.delivery.city Invoice Delivery City string
invoice.address.delivery.zipcode Invoice Delivery Zip Code string
invoice.address.delivery.state Invoice Delivery State Name string
invoice.address.delivery.country Invoice Delivery Country Name string
invoice.contract If invoice is created from Contract. Contains same variables as Contract context
invoice.payments List of Invoice Payments. Contains same variables as Payment context list
invoice.url Url to invoice in console url

Payment context

Variable Name Description / Value source
payment.sum Sum of Payment
payment.processor.id Payment processor ID
payment.processor.code Payment processor code
payment.processor.name Payment processor name
payment.created Payment creation time, localized
payment.message Payment message, if exists. Can contain additional details of the payment for ex. when payment needs customer authentication or payment has failed