---
title: "How do I send an Amazon Simple Queue Service (SQS) notification when an event occurs?"
slug: "how-do-i-send-an-amazon-simple-queue-service-sqs-notification-when-an-event-occurs"
updated: 2025-04-17T09:29:09Z
published: 2025-04-17T09:29:09Z
canonical: "support.lusid.com/how-do-i-send-an-amazon-simple-queue-service-sqs-notification-when-an-event-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.

# How do I send an Amazon Simple Queue Service (SQS) notification when an event occurs?

Providing you are a LUSID user with sufficient access control permissions, you can create a notification to send to [Amazon SQS](https://aws.amazon.com/sqs/) when [an event you have subscribed to](/v1/docs/how-do-i-subscribe-to-an-event) occurs.

For example, you could queue a SQS message 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](/v1/docs/how-do-i-subscribe-to-an-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:
  - A **Key** of `apiKey` with a **Value** containing your [AWS access key ID](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-appendix-sign-up.html).
  - A **Key** of `apiSecret` with a **Value** containing your AWS secret access key.
  - A **Key** of `queueUrl` with a **Value** containing your [SQS queue URL](https://console.aws.amazon.com/sqs/). [See how to upload credentials to the Configuration Store.](/v1/docs/how-do-i-upload-information-to-the-configuration-store)
2. [Obtain an API access token](/v1/docs/how-do-i-obtain-and-use-a-short-lived-api-access-token-from-okta).
3. Call the [CreateNotification](https://www.lusid.com/docs/api/notification/endpoints/notifications/CreateNotification/) API for your LUSID domain, passing in your API access token and:
  - The `scope` and `code` of the [subscription](/v1/docs/how-do-i-subscribe-to-an-event) 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](/v1/docs/using-mustache-templates-to-enrich-notifications) 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:

```json
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:

```json
{
  "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"
}
```
