Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to Build a Serverless Chatbot for $0?

751 views

Published on

Predavanje How to Build a Serverless Chatbot for $0? koje je Slobodan Stojanović iz kompanije CloudHorizon održao 6. februara 2017. godine na 14. Mobile Monday Srbija događaju.

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

How to Build a Serverless Chatbot for $0?

  1. 1. HOW TO BUILD A SERVERLESS CHATBOT FOR $0
  2. 2. I’M SLOBODAN STOJANOVIC CTO OF CLOUD HORIZON JS BELGRADE MEETUP ORGANIZER GITHUB.COM/STOJANOVIC TWITTER.COM/SLOBODAN_
  3. 3. CLOUD HORIZON WE HELP BUSINESSES BUILD INNOVATIVE WEB AND MOBILE SOLUTIONS
  4. 4. CHATTERBOT / CHAT BOT a type of conversational agent, a computer program designed to simulate an intelligent conversation with one or more human users via auditory or textual methods.
  5. 5. A BIT OF A HISTORY
  6. 6. • 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)
  7. 7. WHEN PARRY MET ELIZA
  8. 8. CHATBOT PLATFORMS
  9. 9. HOW CHATBOTS WORK
  10. 10. MOST OF THEM ARE USING WEBHOOKS
  11. 11. Hello { sender: { id: 12345 }, recipient: { id: 54321 }, timestamp: 1483413621558, message: { app_id: 999999, text: 'Hello' } } { recipient: { id: '12345' }, message: { text: 'Hi there' } } Hi there
  12. 12. MOST OF THEM? WHAT ABOUT THE DIFFERENT ONES?
  13. 13. • Slack Bot users • Amazon Alexa • iMessage and Siri
  14. 14. WHAT DO YOU NEED TO KNOW TO BUILD A CHATBOT
  15. 15. ARTIFICIAL INTELLIGENCE
  16. 16. NATURAL LANGUAGE PROCESSING
  17. 17. <PROGRAMMING/>
  18. 18. WHAT DO YOU NEED TO KNOW TO SETUP A CHATBOT
  19. 19. • Server • SSL • Setup API / Webhooks • Register app / bot • Setup tokens, webhook url, etc. • Write the logic • …
  20. 20. IS THERE A BETTER WAY?
  21. 21. YES, OF COURSE!
  22. 22. • Visual chatbot builders (Chatfuel) • Bot frameworks (Microsoft Bot Framework) • Amazon Lex •Many other options
  23. 23. BUILDING CHATBOTS IS NOT FUN, MOST OF THE TIME AT LEAST, NOT AS MUCH AS IT SHOULD BE
  24. 24. WE DECIDED TO FIX THAT AT LEAST, FOR US
  25. 25. MEET CLAUDIA BOT BUILDER
  26. 26. Claudia Bot Builder is an extension library for Claudia.js that helps you create bots for 10 platforms.
  27. 27. The key idea behind the project is to remove all the boilerplate code and common infrastructure tasks, so you can focus on writing the really important part of the bot – your business workflows.
  28. 28. OK, LET ME SHOW YOU
  29. 29. var botBuilder = require('claudia-bot-builder') module.exports = botBuilder(function(message) { return 'Hi there! You sent “' + message.text + '“' })
  30. 30. const botBuilder = require('claudia-bot-builder') module.exports = botBuilder(message => `Hi there! You sent “${message.text}”`)
  31. 31. • AMAZON WEB SERVICES ACCOUNT • Node.js (version 4.3.2 is preferred) • Install Claudia and Claudia Bot Builder from NPM PREREQUISITES
  32. 32. claudia create --region eu-central-1 --api-module bot
  33. 33. SIMPLY RUN ONE COMMAND TO DEPLOY THE BOT
  34. 34. TO SETUP DIFFERENT PLATFORMS ADD ANOTHER FLAG
  35. 35. claudia create --region eu-central-1 --api-module bot --configure-fb-bot
  36. 36. ALL SUPPORTED PLATFORMS
  37. 37. • configure-fb-bot • configure-slack-slash-command •configure-slack-slash-app •configure-viber-bot •configure-telegram-bot •configure-skype-bot •configure-alexa-skill •configure-twilio-sms-bot •configure-kik-bot •configure-groupme-bot
  38. 38. LET’S SEE IT
  39. 39. HOW IT WORKS
  40. 40. zzz… { sender: { id: 12345 }, recipient: { id: 54321 }, timestamp: 1483413621558, message: { app_id: 999999, text: 'Hello' } } { recipient: { id: '12345' }, message: { text: 'Hi there' } } { sender: 12345, platform: ’facebook’, text: ‘Hello’, postback: false, originalRequest: {…} } HelloHi there
  41. 41. PRICE
  42. 42. $0
  43. 43. AWS LAMBDA PRICING •$0.20 per 1 million requests •$0.00001667 for every GB-second used •First million requests each month are free •First 400,000 GB-seconds are free
  44. 44. AWS LAMBDA IS STATELESS. HOW DO WE SAVE THE STATE?
  45. 45. USE DYNAMO DB
  46. 46. IS THERE AN EASIER WAY TO BUILD COMPLEX MESSAGES?
  47. 47. YES!
  48. 48. const botBuilder = require('claudia-bot-builder'); const fbTemplate = botBuilder.fbTemplate; module.exports = botBuilder(message => { if (message.type === 'facebook') { const newMessage = new fbTemplate.Text('What's your favorite House in Game Of Thrones'); return newMessage .addQuickReply('Stark', 'STARK') .addQuickReply('Lannister', 'LANNISTER') .addQuickReply('Targaryen', 'TARGARYEN') .addQuickReply('None of the above', 'OTHER') .get(); } });
  49. 49. CAN WE ADD NLP FOR $0 TOO?
  50. 50. YES OF COURSE, THERE’S A FEW OPTIONS:
  51. 51. • API.ai • Wit.ai • IBM Watson* • Luis.ai
  52. 52. EXAMPLES?
  53. 53. CLAUDIA.JS EXAMPLE PROJECTS:
 GITHUB.COM/CLAUDIAJS/EXAMPLE-PROJECTS
  54. 54. SAMPLE BOTS:
  55. 55. SPACE EXPLORER FB BOT:
 M.ME/SPACE.EXPLORER.BOT
 GITHUB.COM/STOJANOVIC/SPACE-EXPLORER-BOT
  56. 56. LAPTOP FRIENDLY VIBER BOT:
 VIBER.COM/LAPTOPFRIENDLY
 GITHUB.COM/STOJANOVIC/LAPTOP-FRIENDLY-BOT
  57. 57. HOLYJS CONFERENCE BOT:
 TELEGRAM.ME/HOLYJS_BOT
 GITHUB.COM/STOJANOVIC/HOLYJS-BOT
  58. 58. VACATION TRACKER FOR SLACK:
 VACATIONTRACKERBOT.COM
  59. 59. VACATIONTRACKERBOT.COM
  60. 60. MORE INFO
  61. 61. CLAUDIAJS.COM 
 GITHUB.COM/CLAUDIAJS/CLAUDIA-BOT-BUILDER
  62. 62. WHAT’S NEXT?
  63. 63. QUESTIONS?
 @SLOBODAN_ SLIDES: bit.ly/2kjaegq

×