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
230
Prompt Engineering for Developers @ AWS Community Day Timișoara
slobodan
0
180
AI Agents with JavaScript
slobodan
0
490
Prompt Engineering for Developers @ AWS Community Day Adria 2024
slobodan
0
350
From 1 to 250 Lambda Functions in Production: Evolving a Startup Serverless Architecture @ Serverless Days Milan
slobodan
0
230
Building Production-Ready Apps with AI
slobodan
0
370
Advanced GraphQL Architectures: Serverless Event Sourcing and CQRS @ ReactSummit
slobodan
0
330
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
380
Other Decks in Technology
See All in Technology
パスキーの自動テストはどこまでいけるのか
teamlab
PRO
0
280
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
290
触りたくないデータに、どう触るか AI時代のRBACアクセスガバナンス
ivry_presentationmaterials
0
280
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
230
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
160
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
310
価値について
gree_tech
PRO
0
100
Code for Security プロジェクト紹介 2026年10月
yu23ki14
0
110
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
440
ウォンテッドリーの最近のプロダクトと技術の紹介
stomk
0
130
WasmをRustにする
sansantech
PRO
0
270
Classmethod Company Deck
satoshi7
1
730
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
How to train your dragon (web standard)
notwaldorf
96
6.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
220
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
RailsConf 2023
tenderlove
30
1.6k
Optimizing for Happiness
mojombo
378
71k
We Have a Design System, Now What?
morganepeng
55
8.4k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
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