Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Picking Records with JavaScript and a Button
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Gordon Diggs
September 11, 2016
Technology
94
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Picking Records with JavaScript and a Button
Gordon Diggs
September 11, 2016
More Decks by Gordon Diggs
See All by Gordon Diggs
John Coltrane: Lessons in Leadership
gordondiggs
2
320
The Customer Gap
gordondiggs
1
130
Kafka Partitioning Algorithm
gordondiggs
0
170
Supbutton
gordondiggs
0
110
Rayons
gordondiggs
0
110
Sous Vide
gordondiggs
0
130
Dev Events & Internal Tools at Paperless Post
gordondiggs
0
130
The Joys and Pains of Working With an Old Codebase
gordondiggs
0
170
The Joys and Pains of Working with an Old Codebase
gordondiggs
1
2.4k
Other Decks in Technology
See All in Technology
デザインレビューは自動化できるのか?─ Flutter × Figma で UI 品質保証を考える
techiro
2
820
なぜ東京にいる私が、新潟の技術コミュニティを運営するのか by 八雲慎之助
yakumo
0
220
新卒エンジニア、 介護士になる
ryu1013
1
690
DBTS2026 盛り上がってますか!?Databricksが実現するAI時代のデータ基盤
akuwano
1
190
「いつか使う」の「いつか」は来ない 〜AI駆動開発における「作らない」判断について〜
ikki0006
0
150
詳解 never 型 - ボトム型の性質を深掘り
nealle
0
160
分析作業をどこまで任せるか自分で決められる AIネイティブBI『Golden Analytics』が 良さげな話 /golden-analytics-is-ai-native-bi
shinyaa31
0
130
内製アプリとClaudeスキルのセキュリティチェック、 Backlogの課題で回しています。
ayaka_egaaa
0
150
登壇はいいぞ! 〜Kaigi on Railsに登壇して起きた3つの変化〜
occhi
0
110
2026 Apache Flink Community Checkpoint
rmetzger
0
200
re:Invent2026 事前勉強会 歴史と愉しみ方10分LT編
toshi_atsumi
0
150
コードレビューをなくして見えたもの
henteko
0
140
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
4k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
240
Music & Morning Musume
bryan
48
7.5k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
350
Navigating Team Friction
lara
192
16k
Designing for humans not robots
tammielis
254
26k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
From π to Pie charts
rasagy
1
440
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Designing for Performance
lara
612
70k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
970
Transcript
Picking Records with JavaScript and a Button ManhattanJS 20160914
Picking Records with JavaScript and a Button ManhattanJS 20160914
@GordonDiggs
None
None
None
None
None
Lambda Example Sources • S3 file created or deleted •
SNS event • Updates to a DynamoDB table
None
None
None
Requirements • Get a random record • Send a text
message with that record’s information
const env = require("node-env-file"); env(`${__dirname}/.env`); process.env.NODE_CONFIG_DIR = "/var/task/config"; const twilio
= require("twilio")(process.env.ACCOUNT_SID, process.env.AUTH_TOKEN) , getJSON = require("get-json"); const getRecord = function(callback) { getJSON("https://rayons.info/items/random.json", function(err, item) { if (err) { console.log("got an error: ", err); callback(null); } else { const itemURL = `https://rayons.info/items/${item.id}`; callback(`You should listen to "${item.title}" by ${item.artist}: ${itemURL}`); } }); }; const sendSMS = function(message, callback) { twilio.sendMessage( { body: message, from: process.env.FROM_NUMBER, to: process.env.TO_NUMBER }, function(err, responseData) { console.log("Twilio response:", responseData); if (err) { callback("API request completed with error(s)."); } else { callback("API request sent successfully."); } } ); }; exports.handler = function (event, context) { getRecord(function(message) { if (message) { sendSMS(message, function(status) { context.done(null, status); }); } else { context.done(); } }); };
const env = require("node-env-file"); env(`${__dirname}/.env`); process.env.NODE_CONFIG_DIR = "/var/task/config"; const twilio
= require("twilio")(process.env.ACCOUNT_SID, process.env.AUTH_TOKEN) , getJSON = require("get-json");
const getRecord = function(callback) { getJSON("https://rayons.info/items/random.json", function(err, item) { if
(err) { console.log("got an error: ", err); callback(null); } else { const itemURL = `https://rayons.info/items/${item.id}`; callback(`You should listen to "${item.title}" by ${item.artist}: ${itemURL}`); } }); };
const sendSMS = function(message, callback) { twilio.sendMessage( { body: message,
from: process.env.FROM_NUMBER, to: process.env.TO_NUMBER }, function(err, responseData) { console.log("Twilio response:", responseData); if (err) { callback("API request completed with error(s)."); } else { callback("API request sent successfully."); } } ); };
exports.handler = function (event, context) { getRecord(function(message) { if (message)
{ sendSMS(message, function(status) { context.done(null, status); }); } else { context.done(); } }); };
None
Thank you! • github.com/GordonDiggs/what_should_i_listen_to_lambda • aws.amazon.com/lambda • twitter.com/GordonDiggs • bitly.com/gd-lambda