Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
let AWS = require('aws-sdk');
const sns = new AWS.SNS();
exports.handler = function (event, context, callback) {
let receiver = event['receiver'];
let sender = event['sender'];
let message = event['message'];
let isPromotional = true;
console.log("Sending message", message, "to receiver", receiver);
Message: message,
MessageAttributes: {
DataType: 'String',
StringValue: 'Promotional'
'AWS.SNS.SMS.SenderID': {
DataType: 'String',
StringValue: sender
PhoneNumber: receiver
.then(data => {
console.log("Sent message to", receiver);
callback(null, data);
.catch(err => {
console.log("Sending failed", err);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.