--- title: "Using the Manual event to notify people when non-LUSID activity occurs" slug: "using-the-manual-event-to-notify-people-when-non-lusid-activity-occurs" tags: ["notification service ", "events", "subscriptions"] updated: 2024-11-28T10:26:38Z published: 2024-11-28T10:26:38Z canonical: "support.lusid.com/using-the-manual-event-to-notify-people-when-non-lusid-activity-occurs" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.lusid.com/llms.txt > Use this file to discover all available pages before exploring further. # Using the Manual event to notify people when non-LUSID activity occurs In this tutorial we'll see how to use LUSID's Notification Service for your own purposes; that is, to notify people or perform actions when activity outside of LUSID or its ecosystem of applications occurs. > **Note**: To complete this tutorial, you must have suitable access control permissions. This can most easily be achieved by assigning your LUSID user the built-in `lusid-administrator` role, which should already be the case if you are the domain owner. If you are informed you do not have a license to perform a certain operation, [contact support](https://www.finbourne.com/contact). For example, imagine we receive a stream of corporate action activity from a news service. For the week beginning Monday 13 February, we might get the following messages: | **Announcement date** | **Company** | **Corporate action** | **JSON representation** | | --- | --- | --- | --- | | Monday 13 February | Apple | Cash dividend | ```json { "AnnouncementDate": "2023-02-13", "Company": "Apple", "CorporateAction": "Cash dividend" } ``` | | Wednesday 15 February | Microsoft | Stock split | ```json { "AnnouncementDate": "2023-02-15", "Company": "Microsoft", "CorporateAction": "Stock split" } ``` | | Friday 17 February | BP | Reverse stock split | ```json { "AnnouncementDate": "2023-02-17", "Company": "BP", "CorporateAction": "Reverse stock split" } ``` | We want to email a group of people each time a message is received. To do this, we can subscribe to the Notification Service's `Manual` event, and then call the `TriggerManualEvent` API to trigger it separately on Monday, Wednesday and Friday, giving each created event the `subject` "New Corporate Action Announced" and a `jsonMessage` containing the JSON representation above. ## Step 1: Subscribing conditionally to the Manual event The first step is to create a conditional subscription to the `Manual` event. The subscription must be conditional as we only want to subscribe to the `Manual` event for corporate action activity. We can do this by mandating that only events triggered with a subject of `New Corporate Action Announced` invoke our subscription. We can call the [CreateSubscription](https://www.lusid.com/docs/api/notification/endpoints/subscriptions/CreateSubscription) API, passing in: - An API access token as a Bearer token in the Authorization HTTP header. [See how to obtain a token.](/v1/docs/how-do-i-obtain-and-use-a-short-lived-api-access-token-from-okta) - `ManualEvent` as our `scope` and `CorporateAction` as our `code` for the subscription. - A `displayName` and `description` for the subscription. - A `status` of `Active`. - The `eventType` to subscribe to. In our case, we want to subscribe to the `Manual` event conditionally, which we can do by populating the `filter` parameter using [LUSID filtering syntax](/v1/docs/using-lusid-filtering-syntax-to-subscribe-to-events-conditionally). Note: You can retrieve the schema for `Manual` by calling the [GetEventType](https://www.lusid.com/docs/api/notification/endpoints/event-types/GetEventType) API. ```json curl -X POST "https://.lusid.com/notification/api/subscriptions" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer " -d '{  "id": {    "scope": "ManualEvent",    "code": "CorporateAction"  },  "displayName": "Corporate Action Event",  "description": "A subscription to new corporate action announcements",  "status": "Active",  "matchingPattern": {    "eventType": "Manual",    "filter": "Body.subject eq 'New Corporate Action Announced'"  } }' ``` The response is as follows: ```json {  "id": {    "scope": "ManualEvent",    "code": "CorporateAction"  },  "displayName": "Corporate Action Event",  "description": "A subscription to new corporate action announcements",  "status": "Active",  "matchingPattern": {    "eventType": "Manual",    "filter": "Body.subject eq 'New Corporate Action Announced'"  },  "createdAt": "2023-02-04T10:32:04.2124448+00:00",  "userIdCreated": "00uji4twb4jDcHGjN2p8",  "modifiedAt": "2023-02-04T10:32:04.2124448+00:00",  "userIdModified": "00uji4twb4jDcHGjN2p8",  "useAsAuth": "00uji4twb4jDcHGjN2p8",  "href": "https://.lusid.com/notification/api/subscriptions/ManualEvent/CorporateAction" } ``` You can sign in to the [LUSID web app](https://www.lusid.com/app) to view the new subscription on the **Subscription Management** dashboard, available from the top left menu under **Jobs & Scheduling**: ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/4b80f241-1ba5-4c65-884f-74bb58c88416.png?sv=2026-02-06&spr=https&st=2026-11-09T06%3A22%3A23Z&se=2026-11-09T07%3A22%3A23Z&sr=c&sp=r&sig=RIpUlXkcTu6ROq5haFA%2BZ89eROg5BfuOtBcCninrzMo%3D) ## Step 2: Attaching a notification template to the event subscription The next step is to create an email notification and attach it to our conditional subscription. To do so, we call the [CreateNotification](https://www.lusid.com/docs/api/notification/endpoints/notifications/CreateNotification) API, passing in our API access token and: - The `scope` and `code` of the subscription to attach the notification to. In our case, `ManualEvent` and `CorporateAction`. - A `displayName` and `description` for the subscription. - A notification `Type` of `Email` with a `Subject` such as `New Corporate Action`. - One or more email recipients under `EmailAddressTo`. - In the `PlainTextBody` and `HtmlBody`, we can use [mustache templates](/v1/docs/using-mustache-templates-to-enrich-notifications) with the syntax `{{Body.jsonMessage.<your-JSON-key>}}` as placeholders for contextual values emitted by the `Manual` event each time we trigger it. For example, if your `jsonMessage` contains the following key/value pairs... ```json "AnnouncementDate": "2023-02-13", "Company": "Apple", "CorporateAction": "Cash dividend" ``` …you can add the keys to the notification body using mustache templates, as shown: ```json curl -X POST "https://.lusid.com/notification/api/subscriptions/ManualEvent/CorporateAction/notifications" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer " -d '{  "notificationId": "CorporateActionNotification",  "displayName": "New Corporate Action Email",  "description": "An email notification for new corporate action announcements",  "notificationType": {    "Type": "Email",    "Subject": "New Corporate Action Announced",    "PlainTextBody": "New corporate action announced for {{Body.jsonMessage.Company}} on {{Body.jsonMessage.AnnouncementDate}}: {{Body.jsonMessage.CorporateAction}}.",    "HtmlBody": "

New corporate action announced for {{Body.jsonMessage.Company}} on {{Body.jsonMessage.AnnouncementDate}}: {{Body.jsonMessage.CorporateAction}}.

"    "EmailAddressTo": [      "some-user@acme.com"    ]  } }' ``` ## Step 3: Triggering the Manual event each time a corporate action occurs We can now call the [TriggerManualEvent](https://www.lusid.com/docs/api/notification/endpoints/manual-event/TriggerManualEvent) API each time we receive news of a corporate action to trigger the `Manual` event and invoke our subscription, specifying in the body of the request: - A case-sensitive value for the `subject` field that matches the condition in our subscription, which is `New Corporate Action Announced`. - An appropriate value for the mandatory `message` field. Note: You can retrieve the schema for `Manual` by calling the [GetEventType](https://www.lusid.com/docs/api/notification/endpoints/event-types/GetEventType) API. - Contextual values in the `jsonMessage` field for each of the JSON keys in our mustache template. For example, on Monday 13 February we might call the `TriggerManualEvent` API as follows: ```json curl -X POST "https://.lusid.com/notification/api/manualevent" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer " -d '{  "Body": {    "message": "A new corporate action has been announced",    "subject": "New Corporate Action Announced",    "eventTime": "2022-02-13",    "jsonMessage": {      "AnnouncementDate": "2023-02-13",      "Company": "Apple",      "CorporateAction": "Cash dividend"    }  } }' ``` …and receive the following email: ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/7f819ca7-f1fb-4442-be2b-976d136e97d3.png?sv=2026-02-06&spr=https&st=2026-11-09T06%3A22%3A23Z&se=2026-11-09T07%3A22%3A23Z&sr=c&sp=r&sig=RIpUlXkcTu6ROq5haFA%2BZ89eROg5BfuOtBcCninrzMo%3D) On Wednesday 15 February we might call the `TriggerManualEvent` API as follows: ```json curl -X POST "https://.lusid.com/notification/api/manualevent" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer " -d '{  "Body": {    "message": "A new corporate action has been announced",    "subject": "New Corporate Action Announced",    "eventTime": "2022-02-15",    "jsonMessage": {      "AnnouncementDate": "2023-02-15",      "Company": "Microsoft",      "CorporateAction": "Stock split"    }  } }' ``` On Friday 17 February we might call the `TriggerManualEvent` API as follows: ```json curl -X POST "https://.lusid.com/notification/api/manualevent" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer " -d '{  "Body": {    "message": "A new corporate action has been announced",    "subject": "New Corporate Action Announced",    "eventTime": "2023-02-17",    "jsonMessage": {      "AnnouncementDate": "2023-02-17",      "Company": "BP",      "CorporateAction": "Reverse stock split"    }  } }' ``` ### Next steps We can attach more than one notification to our subscription in order to perform several operations each time we trigger the event. For example: - We could create a webhook that calls the [UpsertInstrumentEvents](https://www.lusid.com/docs/api/lusid/endpoints/corporate-action-sources/UpsertInstrumentEvents/) API to automatically load the corporate action into LUSID. [See how to create a webhook to call a LUSID API when an event occurs.](/v1/docs/how-do-i-create-a-webhook-to-call-a-lusid-api-when-an-event-occurs) - We could attach an SMS notification to text a group of people when the event is triggered. [See how to notify people via SMS when an event occurs.](/v1/docs/how-do-i-notify-people-via-sms-when-an-event-occurs)