Parameters of the message templates

From ISPWiki

Jump to: navigation, search


Contents

Template functions

Message templates can be used to form notifications that are sent to BILLmanager customers.

The process of creating a message includes the system objects which parameters should be included into the XML document, and an XSLT template.

Before sending a message to customers, BILLmanager collects information about required objects and places their parameters into the XML document to which the XSLT template will be applied.

Editing template

Edit a message template for each locale you have configured in the system. While creating the template, you may use the mechanisms described below.

Editing template text

A text template is an XSLT stylesheet that will be applied to the XML document that contains the information about BILLmanager objects required for providing information about the event that caused a message to be sent.

In this section we will describe how to create a simple message stylesheet.

Below is an empty stylesheet:

<?xml version='1.0'?>                                                          
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:mgr="http://ispsystem.com/xslplugin">
<xsl:output method='text' encoding='UTF-8' omit-xml-declaration='yes'/>
<xsl:template match='doc'>
</xsl:template>
</xsl:stylesheet>

where:

  • xmlns:mgr="http://ispsystem.com/xslplugin"> - additional function name space:
    • replace - replace one character set into another in the text. It has three parameters: where to replace, what to replace and into what to replace.
    • random - generate random figures.
    • strsum - output textual representation of the sum. It has two parameters: currency amount and currency id. You may use UAH for currency, any other value will output amount in roubles.
    • dateformat - required date format. Example: "select="mgr:dateformat('2011-12-31', '%A, %d, %B, %Y')" outputs "Sunday, 31, December, 2011". You can specify the format the same way as in the "strftime" function of the "С" language.
    • encodesubject - encode the text into Base64.
    • escapeurl - escape URL symbols;
  • The xsl:stylesheet tag - beginning of the stylesheet text.
  • The xsl:output tag - format of the stylesheet output
  • The xsl:template tag - beginning of the stylesheet template. match='doc' means that all the data will be selected from "doc" of the XML document.

The xsl:template tag contains description of the stylesheet that will be included into the message, data sampling and conditional branching.

First three columns of the message template should contain the data required for a mail gateway to correctly send messages, such as "From:", "Subject:" and "Content-Type:". Following is a standard part of the stylesheet for these fields in BILLmanager:

From: <xsl:value-of select="project.notifyemail"/>
Subject: <xsl:value-of select="mgr:encodesubject('Message subject')"/>
Content-Type: text/plain; charset=utf-8

If you need to add data from the XML text into the message, you may use <xsl:value-of select='xpathquery' disable-output-escaping='yes'/>, where xpathquery is the data sampling XPath request.

For example, if you have the XML document:

<?xml version="1.0" encoding="UTF-8"?>
<doc>
  <hostname>test.example.com</hostname>
  <item.id>1</item.id>
  <item.name>Hosting services ServicePlanName #1 (user1), 1 month</item.name>
...
  <item.billdate>2011-01-01</item.billdate>
  <item.expiredate>2011-01-01</item.expiredate>
...
  <itemip>
    <ip>10.0.0.1</ip>
    <ip>10.0.0.2</ip>
    <ip>10.0.0.3</ip>
  </itemip>
</doc>

to display "item.billdate", you need to use "<xsl:value-of select="item.expiredate"/>"

In your template you may use any constructions that are allowed in XSLT.

Testing template

While creating the message template, you can see a resulting message for a BILLmanager database object. To do that, you can use the Test function in the Message template module.

This procedure involves 3 steps:

  • Enter database object parameters;
  • View the XML document to which the style will be applied;
  • View the results.

Template parameters

Each message in BILLmanager includes a number of parameters that BILLmanager will prompt you to enter to specify an object for which a message is created. The following is a list of parameters:

  • autoaddon
    • addon.id - add-on identifier.
  • autoprolongwarning
    • items - two values separated by '='. The first value is an item identifier, the second one is a renewal cost.
  • coloopen, dedicopen, dnsopen, rhostopen, rvdsopen, vdsopen, vhostopen, licopen, newcertificate, itemsuspend
    • item.id - item identifier.
  • confirmemailnotify
    • gate.id - mail gateway identifier.
    • user.id - user identifier.
  • creditgeneratenotify
    • credit.id - account identifier.
  • domainerroroperation
    • operation - an error occurred while performing this operation.
    • item.id - domain identifier.
    • errorparams - contact fields that contain errors.
    • contactid - domain registration contact identifier.
    • msgerror - error message.
  • domainsenddocs
    • items - identifiers of the domains space for which documents are required.
  • domautorenew, domexpirewarning
    • items - domain identifiers space separated.
  • errorcertificate
    • item.id - identifier of the certificate that caused an error.
  • expirecertificate
    • item.id - expiring certificate identifier.
  • itemexpirewarning
    • items - item identifiers space separated.
  • licautoprolong, licexpired, licexpirewarning
    • items - license identifiers space separated.
  • lowmoney
    • subaccount.id - payer identifier.
    • days, balance, daily - parameters are transferred to XML without processing.
  • moreaccountnotify
    • gate.id - gateway identifier.
  • nearaddonmax, overaddonmax
    • item.id - item identifier.
    • addon.id - identifier of the service package detail.
  • newadminmessagenotify
    • message.id - message indentifier.
  • newmessagenotify, newresponsenotify
    • adminticket.id - ticket identifier.
    • userid - user identifier.
    • in_reply_to - transferred to XML without processing.
  • newsnotify
    • message.id - message identifier.
  • overlimit
    • item.id - item identifier.
    • expense.id - service overage expense identifier.
  • recovery
    • user.id - user identifier.
  • registration
    • account.id - customer identifier.
  • unknownemailnotify
    • gate.id - gateway identifier.

Messages for user item types have only the item.id parameter (an item identifier).

XML document

An XML document contains BILLmanager database object data to be used when forming a message. These data are specific for each notification. You can view them using the test function.

Was this helpful? Yes | No
Views
Personal tools