Views:

Related resources:

Explanation

Tutorials

Reference

Providing you are a LUSID user with sufficient access control permissions, you can create a notification to send to Amazon SQS when an event you have subscribed to occurs. For example, you could queue a SQS message  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 Amazon SQS notification to.

  1. Before you can create a notification, you must perform a one-time setup of your AWS credentials in the LUSID Configuration Store. You need to create a configuration set containing the following:
  2. Obtain an API access token.
  3. 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 unique notificationId.
    • A displayName and, optionally, description.
    • A notificationType containing:
      • A Type of AmazonSqs.
      • A Body containing the notification message. You can use attributes of the subscribed event in mustache templates to make the text more meaningful.
      • An ApiKeyRef containing the reference to apiKey in the configuration set created earlier. For example, if you created a shared configuration set with scope AWS and code SQS, you might enter config://shared/AWS/SQS/apiKey.
      • An ApiSecretRef containing the reference to apiSecret in the configuration set created earlier. For example, if you created a shared configuration set with scope AWS and code SQS, you might enter config://shared/AWS/SQS/apiSecret.
      • An QueueUrlRef containing the reference to queueUrl in the configuration set created earlier. For example, if you created a shared configuration set with scope AWS and code SQS, you might enter config://shared/AWS/SQS/queueUrl.

For example, to attach an Amazon SQS notification to a subscription with the scope PortfolioEvents and code PortfolioCreated you might send the following:

curl -X POST "https://<your-domain>.lusid.com/notification/api/subscriptions/PortfolioEvents/PortfolioCreated/notifications" 
    -H "Authorization: Bearer <your-API-access-token>" 
    -H "Content-Type: application/json" 
    -d '{
    "notificationId": "SqsNotification1",
    "displayName": "AwsSqsNotification",
    "description": "Notification for AWS SQS",
    "notificationType": {
      "Type": "AmazonSqs",
      "Body": "Portfolio created in scope {{Body.portfolioScope}} with code {{Body.portfolioCode}}",
      "ApiKeyRef": "config://shared/AWS/SQS/apiKey",
      "ApiSecretRef": "config://shared/AWS/SQS/apiSecret",
      "QueueUrlRef": "config://shared/AWS/SQS/queueUrl"
  }
    }'

The response is as follows. Note you can use the notificationId to reference the notification again in subsequent API calls:

{
  "notificationId": "SqsNotification1",
  "displayName": "AwsSqsNotification",
  "description": "Notification for AWS SQS",
  "notificationType": {
    "type": "AmazonSqs",
    "body": "Portfolio created in scope {{Body.portfolioScope}} with code {{Body.portfolioCode}}",
    "apiKeyRef": "config://shared/AWS/SQS/apiKey",
    "apiSecretRef": "config://shared/AWS/SQS/apiSecret",
    "queueUrlRef": "config://shared/AWS/SQS/queueUrl"
  },
  "createdAt": "2023-08-03T09:41:52.6175307+00:00",
  "userIdCreated": "00uji4twb3jDcHGjN2p8",
  "modifiedAt": "2023-08-03T09:41:52.6175307+00:00",
  "userIdModified": "00uji4twb3jDcHGjN2p8",
  "href": "https://<your-domain>.lusid.com/notification/api/subscriptions/PortfolioEvents/PortfolioCreated/notifications/SqsNotification1"
}

Using the LUSID web app

<Coming soon>