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
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
Transcript
20 slides
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
More Decks by Gordon Diggs
See All by Gordon Diggs
John Coltrane: Lessons in Leadership
gordondiggs
2
330
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
生成AI時代のIAMのマニアックな話
takuros
6
3k
Claude Codeで作ったアプリを安全に公開する/Built with Claude Japan 2026
yoshidashingo
0
230
LLM 基盤と kagent v0 を全部 k8s に入れてみた / Deploy both LLM and kagent v0 in k8s
kota2and3kan
0
130
コードレビューをなくして見えたもの
henteko
0
150
AI Agent 時代のデータ基盤: ClickHouse で実現する 超高速分析とコスト削減の両立
jozono
0
230
並列度を下げたら速くなった — go build の重複コンパイルを実測で見る
tomoaki25
2
1.2k
Reticulum, le réseau cypherpunk dont vous avez besoin !
rlifchitz
0
130
公共分野での生成AI活用
toru_kubota
1
320
The Author Pays
hiccupps
0
170
[JAWS Festa 2026]一番いい仕事は、請求書に現れない / jawsfesta2026
sh_fk2
2
450
これからのデータエンジニアの役割について考える / Rethinking the Role of Data Engineers in the AI Era
okiyuki99
0
370
[dbts2026]数十PBの超巨大データ×AI活用を支えるSnowflakeの実力〜大規模環境におけるアーキテクチャと運用のリアル〜
y_matsubara
0
130
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
The Invisible Side of Design
smashingmag
301
52k
The Curse of the Amulet
leimatthew05
4
17k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
560
Designing for humans not robots
tammielis
254
26k
30 Presentation Tips
portentint
PRO
1
470
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
530
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
300
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
What's in a price? How to price your products and services
michaelherold
247
13k
We Are The Robots
honzajavorek
0
440