Views:

Related resources:

Explanation

Tutorials

Reference

Providing you are a LUSID user with sufficient access control permissions, you can create an email notification to send to people when an event you have subscribed to occurs. For example, you could email all the portfolio managers when the LUSID ‘portfolio created’ event occurs.

Using the Notification REST API

Currently, you can create one notification per API call. Note you must have already subscribed to the event you want to attach the email notification to.

  1. Obtain an API access token.
  2. Call the CreateNotification API for your LUSID domain, passing in your API access token and:
    • The scope and code of the subscription to attach it to.
    • A displayName and unique notificationId.
    • A Type of Email
    • A Subject. You can use attributes of the subscribed event in mustache templates to make the text more meaningful.
    • A PlainTextBody and a HtmlBody. As above, you can use attributes of the subscribed event in mustache templates.
    • A comma-separated list of email addresses. You can specify up to 10 direct recipients, 10 carbon copies, and 10 blind carbon copies in their respective fields.
    For example, to attach an email notification to a subscription with the scope PortfolioEvents and code PortfolioCreatedEvent:
    curl -X POST "https://<your-domain>.lusid.com/notification/api/subscriptions/PortfolioEvents/PortfolioCreatedEvent/notifications" 
        -H "Authorization: Bearer <your-API-access-token>" 
        -H "Content-Type: application/json" 
        -d '{
          "notificationId": "PortfolioCreatedNotification",
          "displayName": "EmailNotification",
          "notificationType": {
            "Type": "Email",
            "Subject": "Portfolio created in {{Body.portfolioScope}}",
            "PlainTextBody": "A portfolio was created with code {{Body.portfolioCode}} in {{Body.portfolioScope}} at {{Header.timestamp}}.",
            "HtmlBody": "<p>A portfolio was created with code {{Body.portfolioCode}} in {{Body.portfolioScope}} at {{Header.timestamp}}.</p>",
            "EmailAddressTo": [
              "portfolio-managers@acme.org"
            ],
            "EmailAddressCc": [],
            "EmailAddressBcc": []
          }
        }'
    The response is as follows. Note you can use the id of the notification (highlighted in red) to reference it again in subsequent API calls:
    {
        "notificationId": "PortfolioCreatedNotification",
        "displayName": "EmailNotification",
        "notificationType": {
          "type": "Email",
          "subject": "Portfolio created in {{Body.portfolioScope}}",
          "plainTextBody": "A portfolio was created with code {{Body.portfolioCode}} in {{Body.portfolioScope}} at {{Header.timestamp}}.",
          "htmlBody": "<p>A portfolio was created with code {{Body.portfolioCode}} in {{Body.portfolioScope}} at {{Header.timestamp}}.</p>"
          "emailAddressTo": [
            "portfolio-managers@acme.org"
          ],
          "emailAddressCc": [],
          "emailAddressBcc": []
        },
        "createdAt": "2023-07-08T10:20:29.1903787+00:00",
        "userIdCreated": "00u91lo2d7X42sdse2p7",
        "modifiedAt": "2023-07-08T10:20:29.1903787+00:00",
        "userIdModified": "00u91lo2d7X42sdse2p7",
        "href": "https://<your-domain>.lusid.com/notifications/api/subscriptions/PortfolioEvents/PortfolioCreatedEvent/notifications/PortfolioCreatedNotification"
    }

Using the LUSID web app

<Coming soon>