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 characters
exports.handler = function(event, context) { | |
var serialNumber = event.SerialNumber; | |
var clickType = event.ClickType; | |
console.log('Device with serial number', serialNumber, "was", clickType.toLowerCase(), "pressed."); | |
}; |
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 characters
var aws = require('aws-sdk'); | |
var sns = new aws.SNS(); | |
exports.handler = function(event, context) { | |
payload1 = new Buffer(event.payload); | |
console.log(payload1); | |
var payload2 = payload1 + ' -- processed by Lambda'; | |
console.log(payload2); | |
var params = { | |
Message: payload2, |
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 characters
console.log('Loading event'); | |
// Twilio Credentials | |
var accountSid = '<your twilio Sid>'; | |
var authToken = '<your twilio authtoken>'; | |
var fromNumber = '<your from number>'; | |
var toNumber = '<your to number>' | |
var https = require('https'); | |
var queryString = require('querystring'); |
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 characters
console.log('Loading event'); | |
var AWS = require('aws-sdk'); | |
exports.handler = function(event, context) { | |
console.log("Request received:\n", JSON.stringify(event)); | |
console.log("Context received:\n", JSON.stringify(context)); | |
var lambdaFunctionArn = "arn:aws:lambda:us-west-2:555818481905:function:ProcessDeviceData-iot-test-hack-event-1"; | |
var lambdaRegion = "us-west-2"; |
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 characters
console.log('Loading event'); | |
var AWS = require('aws-sdk'); | |
var dynamodb = new AWS.DynamoDB(); | |
exports.handler = function(event, context) { | |
console.log("Request received:\n", JSON.stringify(event)); | |
console.log("Context received:\n", JSON.stringify(context)); | |
var tableName = "CommonDynamoDBTable"; |
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 characters
var aws = require('aws-sdk'); | |
var iot = = new AWS.Iot(); | |
var iotData = = new AWS.IotData(); | |
exports.handler = function(event, context) { | |
// Exercising an IoT Data operation as an example | |
var params = { | |
"topic" : "foo/bar", | |
"payload" : "hello world" |
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 characters
{ | |
"sql": "SELECT (CASE Clicks WHEN '1' THEN 'Yo' WHEN '2' THEN 'Wassup?' ELSE 'Howdy.' END) AS message FROM 'button/press'", | |
"ruleDisabled": false, | |
"actions": [{ | |
"sns": { | |
"roleArn": "arn:aws:iam::115330095819:role/icebreaker-sns-actions-role", | |
"targetArn": "arn:aws:sns:us-east-1:115330095819:text-a-phone" | |
} | |
}] | |
} |
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 characters
var AWS = require('aws-sdk'); | |
var iotdata = new AWS.IotData({endpoint: '<CUSTOM ENDPOINT HERE>.iot.<REGION>.amazonaws.com'}); | |
exports.handler = function(event, context) { | |
var params = { | |
thingName: '<THING NAME', | |
payload: '{"state":{"desired":{<STATE GOES HERE>}}}' |
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 characters
//This is a sample lambda function that sends an Email or SMS on click of a button. It creates a SNS topic, subscribes an endpoint (SMS/EMAIL) | |
//to the topic and publishes to the topic. | |
/* | |
The following JSON template shows what is sent as the payload. | |
{ | |
"serialNumber": "GXXXXXXXXXXXXXXXXX", | |
"batteryVoltage": "mV", | |
"clickType": "SINGLE | DOUBLE | LONG" | |
} |
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 characters
var https = require('https'); | |
/** | |
* Pass the data to send as `event.data`, and the request options as | |
* `event.options`. For more information see the HTTPS module documentation | |
* at https://nodejs.org/api/https.html. | |
* | |
* Will succeed with the response body. | |
*/ | |
exports.handler = function(event, context) { |
OlderNewer