Skip to main content

Amazon SNS Component

Manage subscriptions, topics, and messages within Amazon (AWS) SNS

Component key: aws-sns

Description#

Amazon SNS is a service for both application-to-application (A2A) and application-to-person (A2P) communication. The Amazon SNS component allows you to interact with an SNS Topic.

Amazon SNS Connections#

AWS SNS Access Key and Secret#

An AWS IAM access key pair is required to interact with Amazon SNS. Make sure that the key pair you generate in AWS has proper permissions to the SNS resources you want to access. Read about Amazon SNS IAM policies in the AWS docs.

InputNotesExample
Input
Access Key ID
string
/ Required
Notes
An AWS IAM Access Key ID
Example
AKIAIOSFODNN7EXAMPLE
Input
Secret Access Key
password
/ Required
Notes
An AWS IAM Secret Access Key
Example
wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Triggers#

Subscription Trigger#

Confirm subscription and unsubscribe requests and validate SNS messages | key: subscriptionTrigger

InputDefaultNotes
Input
Parse Message
boolean
/ Required
Default
false
Notes
When enabled the message from SNS will be parsed as JSON and returned. If disabled it will be passed as received.

Amazon SNS can be configured to send notification to an HTTPS endpoint. To point SNS notifications towards your integration, identify your integration's webhook URL, and subscribe that URL to an SNS topic. Once a subscription has been created, new messages sent to your SNS topic will be sent to your Prismatic instance via its webhook URL.

Messages from SNS take one of three forms: Subscription Confirmation, Unsubscribe Confirmation or Notification. If a subscription or unsubscribe message is received, this trigger automatically handles the subscription confirmation process. This process lets Amazon SNS know that your instance is ready to receive and process notifications.

Depending on what type of message is received, the trigger will then follow a "Subscribe", "Unsubscribe" or "Notification" branch. These branches make it so you can configure additional steps that execute (e.g. you can alert your team via Slack that a subscription has been confirmed). "Subscribe" and "Unsubscribe" branches can be left blank if you don't have any additional steps you'd like to run once a subscription has been confirmed - you will likely only fill in steps under the "Notification" branch.

In addition to confirming subscriptions, this trigger verifies the signature of messages that come in, so you know they originated from Amazon.

Testing must be done through SNS

Because of signature verification, testing of integrations with this trigger must be done using Amazon SNS. Tests from the integration designer, or from curl or another HTTP client will fail since you can't spoof Amazon's message signature.

When a "Notification" message comes in, and it is a JSON string, you can optionally choose to parse the JSON using the "Parse Message" input. Note that if the incoming message is not valid JSON, the trigger will throw an error when "Parse Message" is set to true.

Output Example Payload#

{  "payload": {    "headers": {      "x-amz-sns-message-type": "Notification",      "x-amz-sns-message-id": "da41e39f-ea4d-435a-b922-c6aae3915ebe",      "x-amz-sns-topic-arn": "arn:aws:sns:us-west-2:123456789012:MyTopic",      "x-amz-sns-subscription-arn": "arn:aws:sns:us-west-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55",      "Content-Length": "761",      "Content-Type": "text/plain; charset=UTF-8",      "Host": "ec2-50-17-44-49.compute-1.amazonaws.com",      "Connection": "Keep-Alive",      "User-Agent": "Amazon Simple Notification Service Agent"    },    "queryParameters": {},    "rawBody": { "data": {} },    "webhookUrls": {},    "webhookApiKeys": {},    "customer": { "externalId": "abc-123", "name": "Example Corp" },    "body": {      "data": {        "Type": "Notification",        "MessageId": "da41e39f-ea4d-435a-b922-c6aae3915ebe",        "TopicArn": "arn:aws:sns:us-west-2:123456789012:MyTopic",        "Subject": "test",        "Message": "test message",        "Timestamp": "2012-04-25T21:49:25.719Z",        "SignatureVersion": "1",        "Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",        "SigningCertURL": "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",        "UnsubscribeURL": "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55"      }    }  },  "branch": "Notification"}

Actions#

Create Topic#

Create an Amazon SNS Topic | key: createTopic

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Name
string
/ Required
Default
 
Notes
Provide a string for the name of the topic.
Example
MyExampleTopic

Output Example Payload#

{  "data": {    "TopicArn": "arn:aws:Example Topic Arn"  }}

Delete Topic#

Delete an Amazon SNS Topic | key: deleteTopic

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Topic Arn
string
/ Required
Default
 
Notes
An Amazon SNS topic is a logical access point that acts as a communication channel.
Example
arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Get Topic Attributes#

Retrieves the attributes of an Amazon SNS Topic. | key: getTopicAttributes

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Topic Arn
string
/ Required
Default
 
Notes
An Amazon SNS topic is a logical access point that acts as a communication channel.
Example
arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Output Example Payload#

{  "data": {    "Attributes": {      "Policy": "Example Policy",      "Owner": "0123456789000",      "topicArn": "arn:aws:sns:us-east-2:123456789012:MyExampleTopic",      "SubscriptionsPending": "1",      "EffectiveDeliveryPolicy": "Example Delivery Policy",      "SubscriptionsConfirmed": "5",      "DisplayName": "Example Display Name",      "SubscriptionsDeleted": "5"    }  }}

List Opt Out Numbers#

Create an Amazon SNS Topic | key: listOptOutNumbers

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Next Token
string
Default
 
Notes
Specify the pagination token that's returned by a previous request to retrieve the next page of results
Example
lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E

Output Example Payload#

{  "data": {    "phoneNumbers": [      "15556164096",      "18980994152",      "18008988422"    ]  }}

List Subscriptions#

Retrieve the subscriptions of an Amazon SNS Topic | key: listSubscriptions

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Next Token
string
Default
 
Notes
Specify the pagination token that's returned by a previous request to retrieve the next page of results
Example
lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E
Input
Topic Arn
string
/ Required
Default
 
Notes
An Amazon SNS topic is a logical access point that acts as a communication channel.
Example
arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Output Example Payload#

{  "data": {    "Subscriptions": [      {        "SubscriptionArn": "arn:aws:sns:us-east-2:123456789012:MyExampleTopic:00000000-00000000-00000000-00000000",        "Owner": "0123456789000",        "Protocol": "https",        "Endpoint": "https://example.com/",        "TopicArn": "arn:aws:sns:us-east-2:123456789012:MyExampleTopic"      },      {        "SubscriptionArn": "PendingConfirmation",        "Owner": "0123456789000",        "Protocol": "email",        "Endpoint": "admin@example.com",        "TopicArn": "arn:aws:sns:us-east-2:123456789012:MyExampleTopic"      }    ]  }}

List Topics#

List available Amazon SNS Topics | key: listTopics

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Next Token
string
Default
 
Notes
Specify the pagination token that's returned by a previous request to retrieve the next page of results
Example
lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E

Output Example Payload#

{  "data": {    "Topics": [      {        "TopicArn": "arn:aws:Example Topic Arn"      }    ]  }}

Publish Message#

Publish a message to an Amazon SNS Topic | key: publishMessage

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Message
string
/ Required
Default
 
Notes
Provide a string for the message you would like to send.
Example
 
Input
Message Attributes
string
Key Value List
Default
 
Notes
For each item, provide a key value pair representing a message attribute. When determining your message attributes, it is important that you follow the specifications listed in the Amazon SNS docs: https://docs.aws.amazon.com/sns/latest/api/API_MessageAttributeValue.html
Example
This is an example attribute
Input
Topic Arn
string
/ Required
Default
 
Notes
An Amazon SNS topic is a logical access point that acts as a communication channel.
Example
arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Output Example Payload#

{  "data": {    "MessageId": "00000000-00000000-00000000-00000000"  }}

Publish SMS#

Publish an SMS message to an Amazon SNS Topic | key: publishSms

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Message
string
/ Required
Default
 
Notes
Provide a string for the message you would like to send.
Example
 
Input
Phone Number
string
/ Required
Default
 
Notes
Provide a phone number that you would like to subscribe to your topic.
Example
12345678901

Output Example Payload#

{  "data": {    "MessageId": "00000000-00000000-00000000-00000000"  }}

Subscribe to Topic#

Subscribe to an Amazon SNS Topic | key: subscribe

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Endpoint
string
/ Required
Default
 
Notes
The endpoint that you want to receive notifications. This could be an email address, URL, phone number, or SQS/application/Lambda/Firehose ARN.
Example
example@prismatic.io
Input
protocol
string
/ Required
Default
https
Notes
When you subscribe an endpoint to a topic, you must specify which protocol to use when this topic receives messages.
Example
 
Input
Topic Arn
string
/ Required
Default
 
Notes
An Amazon SNS topic is a logical access point that acts as a communication channel.
Example
arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Output Example Payload#

{  "data": {    "SubscriptionArn": "arn:aws:sns:us-east-2:123456789012:MyExampleTopic:00000000-00000000-00000000-00000000"  }}

Unsubscribe from a Topic#

Unsubscribe from an Amazon SNS Topic | key: unsubscribe

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
AWS Region
string
/ Required
Default
us-east-1
Notes
AWS provides services in multiple regions, like us-west-2 or eu-east-1. AWS region indicates the region in which your bucket(s) are stored.
Example
us-east-1
Input
Subscription Arn
string
/ Required
Default
 
Notes
The unique identifier for a topic subscription
Example
arn:aws:sns:us-east-2:123456789012:MyExampleTopic:00000000-00000000-00000000-00000000