Created
February 20, 2018 08:39
-
-
Save Udith/14f3d1e1c0d9152fb512426cac1e7cb3 to your computer and use it in GitHub Desktop.
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
/* | |
This function publishes the provided message with subject to the notification | |
topic and excute the provided onSuccess or onFailure callback handler | |
*/ | |
exports.sendNotification = (subject, message, onSuccess, onFailure) => { | |
sns.publish({ | |
Message: message, | |
Subject: subject, | |
MessageAttributes: {}, | |
MessageStructure: 'String', | |
TopicArn: 'arn:aws:sns:us-east-1:YOUR_ACCOUNT_ID:batch-process-notify' | |
}).promise() | |
.then(data => { | |
console.log("Successfully published notification"); | |
onSuccess(); | |
}) | |
.catch(err => { | |
console.log("Error occurred while publishing notification", err, err.stack); | |
onFailure(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment