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
Dr. Strangelove or: How I Learned to Stop Worry...
Search
Slobodan Stojanović
December 11, 2016
Technology
320
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dr. Strangelove or: How I Learned to Stop Worrying and Love the Serverless Chatbots - HolyJS 2016
Presentation from HolyJS 2016 conference in Moscow
Slobodan Stojanović
December 11, 2016
More Decks by Slobodan Stojanović
See All by Slobodan Stojanović
AI Agents: How Do They Work and How to Build Them @ Shift 2025
slobodan
0
220
Prompt Engineering for Developers @ AWS Community Day Timișoara
slobodan
0
170
AI Agents with JavaScript
slobodan
0
480
Prompt Engineering for Developers @ AWS Community Day Adria 2024
slobodan
0
330
From 1 to 250 Lambda Functions in Production: Evolving a Startup Serverless Architecture @ Serverless Days Milan
slobodan
0
220
Building Production-Ready Apps with AI
slobodan
0
360
Advanced GraphQL Architectures: Serverless Event Sourcing and CQRS @ ReactSummit
slobodan
0
320
CofounderGPT - Can an AI be a better co-founder than a human?
slobodan
0
250
From 1 to 201 Lambda functions in production: Evolving a serverless startup architecture
slobodan
0
370
Other Decks in Technology
See All in Technology
Goodbye ShellScript, Hello File-based App
shunsock
0
150
人間はどの意思決定を手放せるのか
kawasima
15
7.2k
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
5
1.8k
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
27
15k
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
2
1.4k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
510
aws-iot-platform-architecture-use-cases.pdf
ma2shita
0
270
Reactの設計論
uhyo
24
13k
Deployment の 先にある AI Agent 基盤 - kagent vNext、Agent Substrate、Hermes から読み解く Agent Runtime の現在地 / k8s-matsuri-2-ai-agent-platform-amsy810
masayaaoyama
4
640
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
150
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
2k
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
5
640
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
How STYLIGHT went responsive
nonsquared
100
6.3k
How to make the Groovebox
asonas
2
2.4k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
200
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Music & Morning Musume
bryan
48
7.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
The Curse of the Amulet
leimatthew05
3
14k
Transcript
DR.STRANGELOVE OR: HOW I LEARNED TO STOP WORRYING AND LOVE
THE SERVERLESS CHATBOTS
#holyjs @slobodan_ I am Slobodan Stojanović CTO of Cloud Horizon
and JS Belgrade Meetup organizer github.com/stojanovic twitter.com/slobodan_
#holyjs @slobodan_ Walt Disney American entrepreneur, cartoonist, animator…
#holyjs @slobodan_ CHATBOTS
#holyjs @slobodan_ IDEA IS NOT NEW
#holyjs @slobodan_ • Turing Test (1950) • Eliza (1966) •
Parry (1972) • A.L.I.C.E. (1995) • Jabberwacky (2005) • Slack Bot (2014) • Telegram and FB Bots (2015) • Many others (2016)
#holyjs @slobodan_ SERVERLESS
#holyjs @slobodan_ FUNCTION AS A SERVICE
#holyjs @slobodan_ • AWS Lambda (2014) • Google Cloud Functions
(2016) • IBM OpenWhisk (2016) • Microsoft Azure Functions (2016)
#holyjs @slobodan_ SERVERLESS + CHATBOTS
#holyjs @slobodan_ Whitney Houston American singer
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_ MEET CLAUDIA BOT BUILDER
#holyjs @slobodan_ var botBuilder = require('claudia-bot-builder') module.exports = botBuilder(function (message)
{ return 'Thanks for sending ' + message.text })
#holyjs @slobodan_ OR WITH ES6
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message =>
`Thanks for sending: ${message.text}` )
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_ LET’S BUILD A TELEGRAM BOT FOR #HOLYJS
#holyjs @slobodan_ Edgar Allan Poe American writer
#holyjs @slobodan_ WITH $0.00 BUDGET
#holyjs @slobodan_ Albert Einstein German-born theoretical physicist
#holyjs @slobodan_ PART 1. SETUP AWS
#holyjs @slobodan_ Nikola Tesla Serbian American inventor
#holyjs @slobodan_ THE ONLY PREREQUISITES FOR CLAUDIA BOT BUILDER ARE
AN AWS ACCOUNT AND NODE.JS
#holyjs @slobodan_ WHAT DO WE NEED?
#holyjs @slobodan_ (NEW) AWS USER WITH FOLLOWING PERMISSIONS: • AWS
Lambda full access • IAM full access (optional) • API Gateway Administrator • API Gateway push to CloudWatch • Cloud Watch full access (optional)
#holyjs @slobodan_ LET’S SEE
#holyjs @slobodan_
#holyjs @slobodan_ PART 2. BOTFATHER
#holyjs @slobodan_ Sigmund Freud Austrian neurologist
#holyjs @slobodan_ THERE’S A TELEGRAM BOT THAT HELPS YOU TO
CREATE TELEGRAM BOTS!
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_ PART 3. SIMPLE BOT
#holyjs @slobodan_ Isaac Newton English physicist and mathematician
#holyjs @slobodan_ BEFORE WE BEGIN WE NEED TO INSTALL CLAUDIA
https://claudiajs.com
#holyjs @slobodan_ $ npm install claudia -g
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message =>
{ return 'Hello from HolyJS bot! You sent: ' + message.text }, { platforms: ['telegram'] }) bot.js file:
#holyjs @slobodan_ $ npm init; $ npm i claudia-bot-builder -S
#holyjs @slobodan_ $ claudia create\ --region eu-central-1\ --api-module bot\ --configure-telegram-bot
#holyjs @slobodan_
#holyjs @slobodan_ PART 4. DEBUGGING
#holyjs @slobodan_ George Orwell English novelist
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message =>
{ console.log(message) return 'Hello from HolyJS bot! You sent: ' + message.text }, { platforms: ['telegram'] }) bot.js file:
#holyjs @slobodan_ $ claudia update
#holyjs @slobodan_
#holyjs @slobodan_ MESSAGE OBJECT
#holyjs @slobodan_ • text • sender • type • originalRequest
• postback
#holyjs @slobodan_ PART 5. SEND MESSAGE / REPLY
#holyjs @slobodan_ William Shakespeare English poet
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message =>
{ console.log(message) return 'Hello from HolyJS bot! You sent: ' + message.text }, { platforms: ['telegram'] }) bot.js file:
#holyjs @slobodan_ SIMPLY RETURN TO REPLY
#holyjs @slobodan_ BUT WHAT ABOUT ASYNC REPLIES?
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message =>
{ return new Promise(resolve => { setTimeout(() => { resolve('Delayed reply ;)') }, 2000) }) }, { platforms: ['telegram'] }) bot.js file:
#holyjs @slobodan_ IS IT POSSIBLE TO REPLY WITH MULTIPLE MESSAGES?
#holyjs @slobodan_ NO!
#holyjs @slobodan_ JUST KIDDING OF COURSE IT IS!
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message =>
{ console.log(message) return [ 'Hello from HolyJS bot!', `You sent: ${message.text}` ] }, { platforms: ['telegram'] }) bot.js file:
#holyjs @slobodan_ PART 6. CUSTOM KEYBOARDS AND ATTACHMENTS
#holyjs @slobodan_ Coco Chanel French fashion designer
#holyjs @slobodan_ require('claudia-bot-builder').telegramTemplate
#holyjs @slobodan_ bot.js file: const botBuilder = require('claudia-bot-builder') const telegramTemplate
= botBuilder. telegramTemplate module.exports = botBuilder(message => { console.log(message) return new telegramTemplate.Text('Hello') .addReplyKeyboard([['Schedule'], ['Info']]) .get() }, { platforms: ['telegram'] })
#holyjs @slobodan_
#holyjs @slobodan_ • Text messages • Custom Keyboard • Photo
messages • Audio messages • Location messages • Venue messages • Stickers • Change chat action • Pause between messages
#holyjs @slobodan_ FORMATTED MESSAGES DOCS: http://bit.ly/claudia-telegram
#holyjs @slobodan_ PART 7. BOT FLOW
#holyjs @slobodan_ J. R. R. Tolkien English writer
#holyjs @slobodan_ YOUR BOT NEEDS A STORYLINE
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message =>
{ console.log(message) if (message.text === ‘/start' || message.text === ‘/start start') return 'Hello, I am Igor, HolyJS bot’ return `You sent: ${message.text}` }, { platforms: ['telegram'] }) bot.js file:
#holyjs @slobodan_ • Schedule info • Current and next talk
info • Conference info • Tweet with #holyjs • Help
#holyjs @slobodan_ #holyjs @slobodan_
#holyjs @slobodan_ IS THERE A BETTER WAY?
#holyjs @slobodan_ PART 8. SAVE THE STATE
#holyjs @slobodan_ Joan de Arc Heroine of France
#holyjs @slobodan_ DYNAMO DB
#holyjs @slobodan_ $ aws dynamodb create-table --table-name holyjs-state \ --attribute-definitions
\ AttributeName=userId,AttributeType=S \ --key-schema AttributeName=userId,KeyType=HASH \ --provisioned-throughput \ ReadCapacityUnits=1,WriteCapacityUnits=1 \ --query TableDescription.TableArn --output text
#holyjs @slobodan_ DynamoDB Policy { "Version": "2012-10-17", "Statement": [ {
"Action": [ "dynamodb:GetItem", "dynamodb:UpdateItem", "dynamodb:PutItem", "dynamodb:Scan" ], "Effect": "Allow", "Resource": "*" } ] }
#holyjs @slobodan_ const botBuilder = require('claudia-bot-builder') const api = botBuilder((message,
originalApiRequest) => { return 'Hello from HolyJS bot! You sent: ' + message.text }, { platforms: ['telegram'] }) api.addPostDeployConfig('dynamoDbTable', 'DynamoDB:', 'configure-bot') module.exports = api bot.js file:
#holyjs @slobodan_ const AWS = require('aws-sdk') const docClient = new
AWS.DynamoDB.DocumentClient()
#holyjs @slobodan_ const params = { TableName: originalApiRequest.env.dynamoDbTable, Key: {
userId: id } } return docClient.get(params).promise() .then(result => console.log('OK', result.Item))
#holyjs @slobodan_ return docClient.get(params).promise() .then(result => console.log('OK', result.Item)) .catch(err =>
{ params = { TableName: originalApiRequest.env.dynamoDbTable, Item: { userId: message.sender } } return docClient.put(params).promise() .then(res => console.log('Create', res)) })
#holyjs @slobodan_ PART 9. MULTILANGUAGE
#holyjs @slobodan_ Mark Twain American author and humorist
#holyjs @slobodan_ EASIEST SOLUTION: SAVE LANGUAGE SETTINGS IN THE STATE
(DYNAMO DB)
#holyjs @slobodan_ #holyjs @slobodan_
#holyjs @slobodan_ PART 10. SCHEDULED NOTIFICATIONS
#holyjs @slobodan_ John Lennon English singer and songwriter
#holyjs @slobodan_ FOR NOTIFICATIONS: CLOUD WATCH SCHEDULED EVENTS
#holyjs @slobodan_
#holyjs @slobodan_ WE WILL USE A NEW LAMBDA FUNCTION
#holyjs @slobodan_ BUT OUR TELEGRAM TOKEN IS IN THE API
GATEWAY STAGE VARIABLES!
#holyjs @slobodan_ A FEW SOLUTIONS: • AWS Lambda environment variables
• Save the token in DynamoDB / State • Pass the token in the event
#holyjs @slobodan_ #holyjs @slobodan_
#holyjs @slobodan_ PART 11. NLP AND AI
#holyjs @slobodan_ H. P. Lovecraft American writer of horror fiction
#holyjs @slobodan_ BUTTONS ARE COOL, BUT…
#holyjs @slobodan_ API.AI WIT.AI LUIS.AI IBM WATSON
#holyjs @slobodan_ LET’S MAKE OUR BOT SMARTER WITH API.AI
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_
#holyjs @slobodan_ #holyjs @slobodan_
#holyjs @slobodan_ SHOW TIME!
#holyjs @slobodan_ Salvador Dali Spanish surrealist painter
#holyjs @slobodan_
#holyjs @slobodan_ LIVE BOT: telegram.me/holyjs_bot
#holyjs @slobodan_ OR Julius Caesar Roman statesman and general
#holyjs @slobodan_ SOURCE CODE: STOJANOVIC/HOLYJS-BOT
#holyjs @slobodan_ SEND PR TO ADD NEW SKILLS: https://github.com/stojanovic/holyjs-bot
#holyjs @slobodan_ CLAUDIA BOT BUILDER CLAUDIAJS/CLAUDIA-BOT-BUILDER
#holyjs @slobodan_ THE END Marilyn Monroe American actress
#holyjs @slobodan_ QUESTIONS TIME @SLOBODAN_ #HOLYJS Erwin Schrödinger Nobel Prize-winning
Austrian physicist