Skip to content

Instantly share code, notes, and snippets.

@meconlin
Last active August 29, 2015 14:27
Show Gist options
  • Save meconlin/5a66c5532578aaf9a73e to your computer and use it in GitHub Desktop.
Save meconlin/5a66c5532578aaf9a73e to your computer and use it in GitHub Desktop.
AWS SNS node sdk make it happen
var AWS = require('aws-sdk')
var sns = new AWS.SNS();
var inner_message = { name:"mymessage", other:"this is other" };
inner_message = JSON.stringify(inner_message);
var payload =
{
"default": inner_message,
};
payload = JSON.stringify(payload);
var params = {
Message: payload, /* required */
MessageStructure: 'json',
Subject: 'subject : test from local',
TopicArn: 'arn ....'
};
sns.publish(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment