Lambda で SMS (Amazon SNS) を送信する

Role

実行する Lambda へ「AmazonSNSFullAccess」の権限を付与します

コード(JavaScript)

[highlight_javascript] // Load the AWS SDK for Node.js var AWS = require('aws-sdk’); exports.handler = function(event, context, callback) { // Create publish parameters var params = { “Message": 'メッセージ内容’, “PhoneNumber": '+81から始まる電話番号’ }; // Create promise and SNS service object var getSMSTypePromise = new AWS.SNS({apiVersion: '2010-03-31’}).publish(params).promise(); // Handle promise’s fulfilled/rejected states getSMSTypePromise.then( function(data) { console.log(data) const response = {}; return response; }).catch( function(err) { console.error(err, err.stack); const response = {}; return response; }); }; [/highlight_javascript]

AWS

Posted by kidatti