Last active
August 29, 2015 14:27
-
-
Save meconlin/5a66c5532578aaf9a73e to your computer and use it in GitHub Desktop.
AWS SNS node sdk make it happen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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