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.

Authorization Notes#

An AWS IAM access key pair is required to interact with Amazon SNS. The AWS access_key_id serves as the API Key, and the secret_access_key serves as the API Secret. Make sure that the key pair you generate in AWS has proper permissions to the SNS resources you want to access.

Triggers#

Subscription Trigger#

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

InputKeyDefaultNotes

Parse Message

boolean
/ Required
parseMessagefalseWhen 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.

note

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

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Name

string
/ Required
nameProvide a string for the name of the topic.MyExampleTopic

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

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

Delete Topic#

Delete an Amazon SNS Topic | key: deleteTopic

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Topic Arn

string
/ Required
topicArnAn Amazon SNS topic is a logical access point that acts as a communication channel.arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret


Get Topic Attributes#

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

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Topic Arn

string
/ Required
topicArnAn Amazon SNS topic is a logical access point that acts as a communication channel.arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

{  "data": {    "Attributes": {      "Policy": "Example Policy",      "Owner": "Example Owner",      "topicArn": "arn:aws:Example Topic Arn",      "SubscriptionsPending": "0",      "EffectiveDeliveryPolicy": "Example Delivery Policy",      "SubscriptionsConfirmed": "1",      "DisplayName": "Example Display Name",      "SubscriptionsDeleted": "5"    }  }}

List Opt Out Numbers#

Create an Amazon SNS Topic | key: listOptOutNumbers

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

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

List Subscriptions#

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

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Topic Arn

string
/ Required
topicArnAn Amazon SNS topic is a logical access point that acts as a communication channel.arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

{  "data": {    "Subscriptions": [      {        "SubscriptionArn": "arn:aws:Example Subscription Arn",        "Owner": "example_owner",        "Protocol": "EMAIL",        "Endpoint": "admin@example.io"      }    ]  }}

List Topics#

List available Amazon SNS Topics | key: listTopics

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

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

Publish Message#

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

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Message

string
/ Required
messageProvide a string for the message you would like to send.

Message Attributes

string
messageAttributesFor 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.htmlkey: myAttr, value: "This is an example attribute"

Topic Arn

string
/ Required
topicArnAn Amazon SNS topic is a logical access point that acts as a communication channel.arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

{  "data": {    "MessageId": "Example Message Id"  }}

Publish SMS#

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

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Message

string
/ Required
messageProvide a string for the message you would like to send.

Phone Number

string
/ Required
phoneNumberProvide a phone number that you would like to subscribe to your topic.12345678901

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

{  "data": {    "MessageId": "Example Message Id"  }}

Subscribe to Topic#

Subscribe to an Amazon SNS Topic | key: subscribe

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Endpoint

string
/ Required
endpointWhen you subscribe an endpoint to a topic, you can publish a notification to the topic and Amazon SNS sends an HTTP POST request delivering the contents of the notification to the subscribed endpoint.example@prismatic.io

protocol

string
/ Required
protocolEMAILWhen you subscribe an endpoint to a topic, you must specify which protocol to use when this client receives messages in the future.EMAIL

Topic Arn

string
/ Required
topicArnAn Amazon SNS topic is a logical access point that acts as a communication channel.arn:aws:sns:us-east-2:123456789012:MyExampleTopic

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret

Output Example Payload#

{  "data": {    "SubscriptionArn": "Example SubscriptionArn"  }}

Unsubscribe from a Topic#

Unsubscribe from an Amazon SNS Topic | key: unsubscribe

InputKeyDefaultNotesExample

AWS Region

string
/ Required
awsRegionus-east-1AWS 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.us-east-1

Subscription Arn

string
/ Required
subscriptionArnThe response from the Subscribe request includes the subscription ARN, even if the subscription is not yet confirmed.1234567890

Authorization#

Authorization is required for this action.
Auth TypeKeyDescriptionFields
API Key / Secretapi_key_secretAPI Key / Secret Combination

API Key |  api_key

API Secret |  api_secret