Amazon SNS connector
Use the Amazon SNS outbound connector to publish messages to an Amazon Simple Notification Service (SNS) topic from your BPMN process.
About this connector
The Amazon SNS outbound connector publishes a message to a standard or FIFO SNS topic and returns the SNS message ID. For example, use it to send an order status notification to subscribers when a process step completes. To start or continue a process when a topic sends a notification, use the Amazon SNS inbound connector.
Prerequisites
To use the Amazon SNS outbound connector, you need an SNS topic and an IAM access key and secret key pair with the sns:Publish permission for that topic.
Learn more about SNS permissions in the SNS Developer Guide.
Use secrets to store credentials and avoid exposing sensitive information from the process. See managing secrets.
Use this connector
New to using an outbound connector? Learn how to add and use this type of connector, apply element templates, use connector secrets, handle results and errors, and more.
Configuration
Authentication
| Property | Type | Required | Description | Example |
|---|---|---|---|---|
| AWS credential | Configuration | No | Select a saved AWS credential with an optional default region, or enter the authentication details and a region in the fields below. Learn more about credentials. | |
| Authentication | Dropdown | Yes, if no AWS credential is set | The AWS authentication strategy:
| |
| Access key | String | Yes, if Authentication is Credentials | The access key of an IAM user with permission to publish to the SNS topic. The value can be plain text, but this isn't recommended due to security concerns. | {{secrets.MY_AWS_ACCESS_KEY}} |
| Secret key | String | Yes, if Authentication is Credentials | The secret key of the IAM user with the access key above. |
Topic properties
| Property | Type | Required | Description | Example |
|---|---|---|---|---|
| Topic ARN | String | Yes | The Amazon Resource Name (ARN) of the SNS topic to publish to. | arn:aws:sns:us-east-1:123456789012:MyTopic |
| Topic type | Dropdown | Yes | The type of the topic: Standard or FIFO. Standard topics maximize throughput; FIFO topics preserve ordering and deduplication. The default is Standard. | |
| Region | String | Yes, if no AWS credential is set or the credential has no default region | The region of the SNS topic. If you select an AWS credential, this value overrides its default region. | us-east-1 |
Operations
Publish message
Publish a message to an Amazon SNS topic.
Input parameters
| Property | Type | Required | Description | Example |
|---|---|---|---|---|
| Message group ID | String | Yes, for FIFO topics | The ID that groups messages in a FIFO topic. Messages within the same group are delivered in sequence. Learn more about message grouping for FIFO topics. Shown when Topic type is FIFO. | |
| Message deduplication ID | String | No, for FIFO topics | A token that prevents duplicate messages in a FIFO topic. Amazon SNS doesn't deliver messages with the same deduplication ID again within the five-minute deduplication interval. Whether you need it depends on the deduplication settings of your FIFO topic. Shown when Topic type is FIFO. | |
| Subject | String | No | The subject of the message. The length must be less than 100 characters. | |
| Message | Text | Yes | The data to publish to the topic. You can enter text or a FEEL expression. If the value isn't a string, for example a FEEL context, the connector serializes it to JSON. | |
| Message attributes | String | No | A FEEL expression that returns the message attributes, which are optional structured metadata for the message. See message attributes. |
Message attributes
Amazon SNS lets you include structured metadata, such as timestamps, geospatial data, signatures, and identifiers, with messages using message attributes. The connector supports non-binary message attributes. Compose each attribute value to comply with the Amazon SNS message attribute data format.
Example of valid message attributes as a FEEL value:
= {
"timestamp": {
"StringValue": today(),
"DataType": "String"
},
"messageSubmittedBy": {
"StringValue": "user12345",
"DataType": "String"
}
}
Output
The connector returns the SNS identifier of the published message:
messageId: The SNS message ID.
Example response:
{
"messageId": "2e062e6b-a527-5e68-b69b-72a8e42add60"
}
To use the message ID in your process, store the response with Result variable, or map it with Result expression. For example, the following expression stores the ID in the createdMessageID process variable:
= {
"createdMessageID": response.messageId
}
Troubleshooting
To learn about general error handling in Camunda, see BPMN errors and failing jobs.