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 |
Format |
company.name |
Preference: COMPANY_NAME |
string |
company.email |
Preference: COMPANY_EMAIL |
string |
company.address |
Preference: COMPANY_ADDRESS |
string |
company.zipcode |
Preference: COMPANY_ZIP_CODE |
string |
company.city |
Preference: COMPANY_CITY |
string |
company.country |
Preference: COMPANY_COUNTRY |
string |
company.phone |
Preference: COMPANY_PHONE |
string |
company.site.url |
Preference: COMPANY_SITE_URL |
string |
company.logo.url |
Preference: COMPANY_LOGO_URL |
string |
company.vat.id |
Preference: COMPANY_VAT_ID |
string |
message.title |
Title/Subject of the message template |
string |
site.name |
Site name. My Shop |
string |
site.console.url |
Site Console Root URL. ex. my-shop.saas.pilvi.com/console |
url |
site.console.login.url |
Site Console Login URL. ex. my-shop.saas.pilvi.com/console/login |
url |
site.console.profile.url |
Site Console Profile Page URL. ex. my-shop.saas.pilvi.com/console/profile |
url |
site.console.invoices.url |
Site Console Invoices Page URL. ex. my-shop.saas.pilvi.com/console/invoices |
url |
site.console.services.url |
Site Console Services Page URL. ex. my-shop.saas.pilvi.com/console/services |
url |
site.manager.url |
Site Manager URL. ex. my-shop.saas.pilvi.com/manager |
url |
site.manager.login.url |
Site Manager Login URL. ex. my-shop.saas.pilvi.com/manager/login |
url |
site.domain |
Site's domain ex. my-shop.saas.pilvi.com |
domain |
site.shop.url |
Site Shop URL. ex. my-shop.saas.pilvi.com |
url |
site.shop.register.url |
Site Shop Register URL. ex. my-shop.saas.pilvi.com/register |
url |
site.shop.login.url |
Site Shop Login URL. ex. my-shop.saas.pilvi.com/login |
url |
year |
Current year |
2000 |
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 |
SERVICE |
numberofdayssinceservicecreated |
Days after Service has been created |
SERVICE |
createdservices |
List of created services. Exists if numberofdayssinceservicecreated defined. Contains same variables as Service context |
SERVICE |
numberofdayfromservicetrialstart |
Days after Service Trial period has been started. |
SERVICE |
numberofdaystillservicetrialend |
Days till Service Trial period end. |
SERVICE |
trialservices |
List of trial services. Exists if numberofdayfromservicetrialstart or numberofdaystillservicetrialend defined. Contains same variables as Service context |
SERVICE / ORDER |
productno |
From PRODUCT_NUMBER condition |
User
context
Variable Name |
Description / Value source |
Format |
user.id |
User Id |
number |
user.email |
User Email |
email |
user.name |
User Full Name |
string |
user.firstname |
User Firstname |
string |
user.lastname |
User Lastname |
string |
user.telephone |
User Telephone |
E.164 |
Profile
context
Variable Name |
Description / Value source |
Format |
profile.id |
Profile Id |
number |
profile.no |
Profile No |
number |
profile.name |
Profile Name |
string |
profile.balance |
Profile Balance |
0.00 |
profile.debt |
Profile Debt |
0.00 |
profile.address.delivery.street |
Profile Delivery Address Street |
string |
profile.address.delivery.city |
Profile Delivery City |
string |
profile.address.delivery.zipcode |
Profile Delivery Zip Code |
string |
profile.address.delivery.state |
Profile Delivery State |
string |
profile.address.delivery.country |
Profile Delivery Country |
string |
profile.address.invoice.street |
Profile Invoice Address Street |
string |
profile.address.invoice.city |
Profile Invoice City |
string |
profile.address.invoice.zipcode |
Profile Invoice Zip Code |
string |
profile.address.invoice.state |
Profile Invoice State |
string |
profile.address.invoice.country |
Profile Invoice Country |
string |
profile.services |
List of active Services on the Profile. Contains same variables as Service context |
|
profile.vatnumber |
Profile VAT Number |
EU VAT |
profile.einvoiceovt |
Profile Electronic Invoice address (OVT) |
string |
profile.properties[].name |
Profile Property Name |
string |
profile.properties[].label |
Profile Property Label |
string |
profile.properties[].value |
Profile Property Value |
string |
profile.properties[].unit |
Profile Property Unit |
string |
profile.mrr |
Profile Monthly Recurring Revenue |
0.00 |
profile.extras.active_services_count |
Active Services count |
0 |
Service
context
Variable Name |
Description / Value source |
Format |
service.id |
Service Id |
number |
service.no |
Service No |
number |
service.name |
Service Name |
string |
service.url |
Service Page URL |
url |
service.expiredate |
Service Expiration Date |
date, localized |
service.expiredate_iso |
Service Expiration Date |
date, ISO 8601 |
service.properties[].name |
Service Property Name |
string |
service.properties[].label |
Service Property Label |
string |
service.properties[].value |
Service Property Value |
string |
service.properties[].unit |
Service Property Unit |
string |
service.properties[].price.amount |
Service Property Price (price in base price period) |
0.00 |
service.properties[].price.priceperiod |
Service Property Base Price Period |
0.00 |
service.properties[].price.billingprice |
Service Property Billing Price (price in service billing period) |
0.00 |
service.properties[].price.billingperiod |
Service Property Billing Period |
1 month |
service.product |
The Product of the Service. Contains same variables as Product context |
|
service.price.amount |
Service Product Price (price in base price period) |
0.00 |
service.price.priceperiod |
Service Product Base Price Period |
1 month |
service.price.billingprice |
Service Billing Price (price in service billing period) |
0.00 |
service.price.billingperiod |
Service Billing Period |
1 month |
service.mrr |
Service Monthly Recurring Revenue |
0.00 |
Order
context
Variable Name |
Description / Value source |
Format |
order.id |
Order ID |
number |
order.no |
Order Number |
number |
order.created |
Order creation time |
date, localized |
order.created_iso |
Order creation time |
date, ISO 8601 |
order.subtotal |
Order Subtotal, the price of the products ordered |
0.00 |
order.servicefeeamount |
Service Fee amount |
string |
order.servicefeepercent |
Service Fee percent if type is percent |
string |
order.servicefeedescription |
Service Fee description |
string |
order.balanceconsumed |
The amount of account balance consumed |
0.00 |
order.total |
Order Total. The total price of the order after reductions such as discounts, account balance use |
0.00 |
order.totalwithvat |
Order Total With VAT |
0.00 |
order.vat.rate |
Order VAT Rate |
0.00 |
order.vat.amount |
Order VAT Amount |
number |
order.reference |
Customer reference |
string |
order.additionalinfo |
Order additional info |
string |
order.invoice |
Invoice from Order. Contains same variables as Invoice context |
|
order.user |
Details of the user who submitted Order. Contains same variables as User context |
|
order.products[] |
List of Products in Order. |
|
order.products[].id |
Product Id |
number |
order.products[].no |
Product Number |
number |
order.products[].name |
Product Name |
string |
order.products[].plan |
Product Plan |
string |
order.products[].image.url |
Product Image URL |
string |
order.products[].productgroup.name |
Product Group Name |
string |
order.products[].properties[].name |
Product Property Name |
string |
order.products[].properties[].label |
Product Property Label |
string |
order.products[].properties[].value |
Product Property Value |
string |
order.products[].properties[].unit |
Product Property Unit |
string |
order.products[].properties[].price.amount |
Product Property Price |
0.00 |
order.products[].properties[].price.priceperiod |
Product Property Base Price Period |
1 month |
order.products[].billingperiod |
Product Billing Period |
1 month |
order.products[].billingprice |
Product Billing Price (price * billingperiod) |
0.00 |
order.products[].billingpricewithvat |
Product Billing VAT Price (price * billingperiod) |
0.00 |
order.products[].trialperiod |
Product Trial Period |
1 month |
order.products[].price |
Product Price (total price within period) |
0.00 |
order.products[].priceperiod |
Product Base Price Period |
1 month |
order.products[].pricewithvat |
Product VAT Price |
0.00 |
order.products[].priceoriginal |
Product Original Price (total price within period) |
0.00 |
order.products[].priceoriginalwithvat |
Product Original VAT Price |
0.00 |
order.products[].openingcosts |
Product Original Opening Costs Price |
0.00 |
order.products[].openingcostswithvat |
Product Opening Costs VAT Price |
0.00 |
order.products[].openingcostsoriginal |
Product Opening Costs Price |
0.00 |
order.products[].openingcostsoriginalwithvat |
Product Original Opening Costs VAT Price |
0.00 |
order.products[].baseprice |
Product Base Price |
0.00 |
order.products[].basepricewithvat |
Product Base VAT Price |
0.00 |
order.products[].basepriceoriginal |
Product Original Base Price |
0.00 |
order.products[].basepriceoriginalwithvat |
Product Original Base VAT Price |
0.00 |
Contract
context
Variable Name |
Description / Value source |
Format |
contract.id |
Contract ID |
number |
contract.no |
Contract Number |
number |
contract.startdate |
Contract start date |
date, localized |
contract.startdate_iso |
Contract start date |
date, ISO 8601 |
contract.invoicedtill |
Contract invoiced till date |
date, localized |
contract.invoicedtill_iso |
Contract invoiced till date |
date, ISO 8601 |
contract.paidtill |
Contract paid till date |
date, localized |
contract.paidtill_iso |
Contract paid till date |
date, ISO 8601 |
contract.reference |
Contract customer referenced |
string |
contract.created |
Contract creation time |
date, localized |
contract.created_iso |
Contract creation time |
date, ISO 8601 |
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.properties[].unit |
Product Property Unit |
string |
product.properties[].price.amount |
Product Property Price |
0.00 |
product.properties[].price.priceperiod |
Product Property Base Price Period |
1 month |
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 Base 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.issuedate_iso |
Invoice Issue Date |
date, ISO 8601 |
invoice.duedate |
Invoice Due Date |
date, localized |
invoice.duedate_iso |
Invoice Due Date |
date, ISO 8601 |
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, localized |
invoice.items[].billingperiodstart_iso |
Billing Period Start Date |
date, ISO 8601 |
invoice.items[].billingperiodend |
Billing Period End Date |
date, localized |
invoice.items[].billingperiodend_iso |
Billing Period End Date |
date, ISO 8601 |
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 |
Quote
context
Variable Name |
Description / Value source |
Format |
quote.id |
Quote Id |
number |
quote.no |
Quote Number |
number |
quote.user |
Details of the user who submitted Quote. Contains same variables as User context |
|
quote.services[].name |
Quote Service Name |
string |
quote.services[].id |
Quote Service Id |
number |
quote.services[].no |
Quote Service Number |
number |
quote.services[].properties[].name |
Quote Service Property Name |
string |
quote.services[].properties[].value |
Quote Service Property Value |
string |
quote.services[].properties[].label |
Quote Service Property Label |
string |
quote.services[].properties[].unit |
Quote Service Property Unit |
string |
quote.services[].properties[].price.amount |
Quote Service Property Price Value (price in Quote base price period) |
0.00 |
quote.services[].properties[].price.amountoriginal |
Property Price Original Value (price in Quote base price period) |
0.00 |
quote.services[].properties[].price.period |
Quote Service Property Base Price Period |
1 month |
quote.services[].properties[].price.billingprice |
Quote Service Property Billing Price |
0.00 |
quote.services[].properties[].price.billingpriceoriginal |
Quote Service Property Original Billing Price |
0.00 |
quote.services[].properties[].price.billingperiod |
Quote Service Property Billing Period |
1 month |
quote.services[].properties[].price.validtill |
Quote Service Property Price Valid till |
date, localized |
quote.services[].properties[].price.validtill_iso |
Quote Service Property Price Valid till |
date, ISO 8601 |
quote.services[].url |
Quote Service Page URL |
string |
quote.services[].expiredate |
Quote Service Expiration Date |
date, localized |
quote.services[].expiredate_iso |
Quote Service Expiration Date |
date, ISO 8601 |
quote.services[].product |
Contains same variables as Product context |
|
quote.services[].price.amount |
Quote Service Price (price in Quote base price period) |
0.00 |
quote.services[].price.amountoriginal |
Quote Service Original Price (price in Quote base price period) |
0.00 |
quote.services[].price.priceperiod |
Quote Service Base Price Period |
1 month |
quote.services[].price.validtill |
Quote Service Price Valid Till Date |
date, localized |
quote.services[].price.validtill_iso |
Quote Service Price Valid Till Date |
date, ISO 8601 |
quote.services[].price.billingprice |
Quote Service Billing Price |
0.00 |
quote.services[].price.billingpriceoriginal |
Service Original Billing Price |
0.00 |
quote.services[].price.billingperiod |
Quote Service Billing Period |
1 month |
quote.status |
Quote Status |
string |
quote.expires |
Quote Expiration Date |
date, localized |
quote.expires_iso |
Quote Expiration Date |
date, ISO 8601 |
quote.created |
Quote Created Date |
date, localized |
quote.created_iso |
Quote Created Date |
date, ISO 8601d |
quote.updated |
Quote Updated Date |
date, localized |
quote.updated_iso |
Quote Updated Date |
date, ISO 8601 |
quote.total |
Quote Services Total Price. |
0.00 |
quote.totalwithvat |
Quote Services Total Price with VAT. |
0.00 |
quote.totaloriginal |
Quote Services Original Total Price. |
0.00 |
quote.totaloriginalwithvat |
Quote services Original Total Price with VAT. |
0.00 |
quote.vat.rate |
Quote VAT Rate |
|
quote.vat.amount |
Quote VAT Amount |
|