Views:

You can use the mustache templating system to create more meaningful notifications.

You can substitute any of the properties of a event into notifications sent out by your subscription to that event. For example, when you examine the ‘portfolio created’ event you can see it has four string properties: PortfolioDisplayName, PortfolioScope, PortfolioCode and PortfolioCreated (highlighted in red):

{
  "values": [
    {
      "id": "TransactionPortfolioCreated",
      "description": "An event of this type is fired whenever a new transaction portfolio is created in LUSID",
      "eventName": "Transaction Portfolio Created",
      "application": "Lusid",
      "jsonSchema": {
        "type": "object",
        "properties": {
          "PortfolioDisplayName": {
            "type": "string"
          },
          "PortfolioScope": {
            "type": "string"
          },
          "PortfolioCode": {
            "type": "string"
          },
          "PortfolioCreated": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "PortfolioDisplayName",
          "PortfolioScope",
          "PortfolioCode",
          "PortfolioCreated"
        ]
      }
    },
    ...
  ],
}

You can use these properties encapsulated in {{}} characters when you create notifications, as placeholders for values generated by the event. For example, you could create an email notification as follows:

{
   "description": "EmailNotification",
   "subject": "Portfolio created in {{PortfolioScope}}",
   "plainTextBody": "A {{PortfolioDisplayName}} portfolio was created with code {{PortfolioCode}} in scope {{PortfolioScope}} at {{PortfolioCreated}}.",
   "htmlBody": "<p>A {{PortfolioDisplayName}} portfolio was created with code {{PortfolioCode}} in scope {{PortfolioScope}} at {{PortfolioCreated}}.</p>",
   "emailAddressTo": [
      "portfolio-managers@acme.org"
   ]
}

The person receiving the email might see:

Subject: Portfolio created in Finbourne-Examples
Body: A UK Equities portfolio was created with code UK-Equities in scope Finbourne-Examples at 2022-07-08 T00:00:00.000000 +00:00.