Last active
March 20, 2024 18:49
-
-
Save netroy/2f984060a7f5f8a8555f6b74f8bc14e9 to your computer and use it in GitHub Desktop.
Revisions
-
netroy revised this gist
Nov 19, 2019 . No changes.There are no files selected for viewing
-
netroy created this gist
Nov 19, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ const appId = [[PINPOINT_APPLICATION_ID]]; const destination = [[YOUR_PHONE_NUMBER]]; const { Pinpoint } = require('aws-sdk'); const pinpoint = new Pinpoint(); const payloadFn = (appId, destination, message) => { const ApplicationId = appId; const Addresses = {}; Addresses[destination] = { ChannelType: 'SMS' }; const MessageConfiguration = { SMSMessage: { Body: message, MessageType: 'TRANSACTIONAL', SenderId: 'CloudwatchAlert' } }; return { ApplicationId, MessageRequest: { Addresses, MessageConfiguration } }; }; exports.handler = async event => { const message = 'Testing'; const payload = payloadFn(appId, destination, message); await pinpoint.sendMessages(payload).promise(); }; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogStream", "logs:CreateLogGroup", "logs:PutLogEvents", "mobiletargeting:SendMessages" ], "Resource": "*" } ] }