SNS Publisher
  • 04 Jan 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

SNS Publisher

  • Dark
    Light
  • PDF

Article summary

This graph template allows the graph to publish an object to Amazon's Simple Notification Service (SNS). 

Amazon Simple Notification Service (SNS) is a flexible, fully managed pub/sub messaging and mobile notifications service for coordinating the delivery of messages to subscribing endpoints and clients. With SNS, you can fan out messages to a large number of subscribers, including distributed systems and services, and mobile devices. It is easy to set up, operate, and reliably send notifications to all your endpoints – at any scale. For more information about SNS and its capabilities, click here.

Package Contents

Graphs

Nodes

  • Javascripts
  • awsSignaturev4
  • createSNSOptions
  • encryptOrDecrypt (optional: Use this to encrypt your tokens to save in appParams)
  • Web Services
  • send to SNS, REST API

Connections

  • SNS service endpoint

Schema Location


{
	"SNS": {
		"options": {
			"headers": {
				"Date": "",
				"x-amz-date": "",
				"content-type": "",
				"Authorization": ""
			},
			"queryString": ""
		},
		"objectToPublish": "",
		"apiResponse": ""
	}
}

Setup

  • Deploy the 'Publish Message to AWS SNS' template to create all the required Xponent resources
  • On the 'Create a New Item' screen, select the 'AWS SNS Publish' Graph
     
  • Configure the SNS REST Web Service connection with the relevant endpoint, and select yours from AWS SNS Supported Countries:
  • Follow the instructions for the setup of the Application Parameters Graph Template
  • AWS Credentials
  • It is optional but recommended that you encrypt your awsAccessKey and your awsSecretAccessKey when storing in the appParams database table
  • Use the included encryptDecrypt javascript node to encrypt your credentials before you save to the appParams table
  • Insert the the AWS SNS parameters into the appParams table using the following SQL:
INSERT INTO appParams(paramKey,paramValue,paramType,description) VALUES
('awsAccessKeyId', 'awsAccessKeyIdKEY GOES HERE', 'string', 'This is the access key for AWS SNS'),
('awsSecretAccessKey', 'awsSecretAccessKey GOES HERE', 'string', 'This is the secret key for AWS SNS'),
('awsSNSRegion', 'awsSNSRegion GOES HERE', 'string', 'This is the SNS Region for AWS SNS'),
('awsSNSTopicARN', 'awsSNSTopicARN GOES HERE', 'string', 'This is the SNS Topic ARN for AWS SNS'),
('awsSNSHost', 'awsSNSHost GOES HERE', 'string', 'This is the SNS Host for AWS SNS');
  • If using encryption, include the additional appParam
INSERT INTO appParams(paramKey,paramValue,paramType,description) VALUES
('awsKeysEncrypted', 'true', 'string', 'Encryption flag for AWS SNS');

Using

  • Place the publishMessageToSNS graph in your graph
  • The expected outputs for this graph are true, 'metaSet'. The parent graph should also accomodate GoTo and Error
  • Set the graph parameter 'objectToPublish', this should be the entire object that needs to the published to the SNS region
  • The result of the API call will be added to the {schema}.SNS.apiResponse array
  • Test your graph

Notes: 

Tip: If appParams is initialized and the 'refreshAppParams' subgraph is used earlier than 'publishMessageToSNS' in your main graph, then feel free to update the start node to avoid duplication

What is likely to go wrong

  • AWS Access Tokens are not encrypted, and you have set awsKeysEncrypted='true'
  • Resolution: pick a method. We recommend encrypting your tokens and using awsKeysEncrypted='true'
  • You are using SNS in a different AWS Region

Typical Deliverables Plan

Use this plan to agree on the requirements of the Xponent user and your client/ brand

  1. Client/ Xponent user to configure the AWS SNS account and provide access keys, host & region details to the Xponent user
  2. Xponent user to deploy publishMessageToSNS graph template and required environments
  3. Create SQL Assets:
    1. If using your own database
      1. Xponent user to create SQL assets
    2. If using the client's database
      1. Provide the SQL creation code above for the brand to create
      2. Xponent will need access to the database - see here for DB connections
  4. Xponent User to deploy the graph and test

Is it helpful? React and share your comment

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence