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 PortfolioCreated
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.
Call the CreateNotification API, passing in your API access token and:
The
scope
andcode
of the subscription to attach it to.A
displayName
and uniquenotificationId
.A
Type
ofEmail
.A
Subject
. You can use attributes of the subscribed event in mustache templates to make the text more meaningful.A
PlainTextBody
and aHtmlBody
. 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 codePortfolioCreatedEvent
: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 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>