Post on 07-Jan-2017
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SVR304
bots + serverless = Vishal Singh, Senior Product Manager,
AWS Lambda
December 1, 2016
What to Expect from the Session
• Introduction to Serverless Chatbots
• Frameworks and integrations for serverless chatbots
• AWS Slack chatbot hackathon summary
• Amazon Lex
• Architecture & benefits
• Demo – building a Facebook chatbot using Lex + Lambda
• Mobile Hub enterprise SaaS connectors
Chatbots
Chatbot is a service designed to simulate conversation with
human users, accessible from a messaging interface.
Key characteristics:
On-demand
Accessible
Efficient
Natural
AWS Lambda: Run code in response to events
COMPUTE SERVICE
EVENT DRIVEN
Run arbitrary
code without
managing
servers
Code only runs
when it needs to
run
Code is all you need Event-driven scaling
Never pay for idle Availability and fault tolerance built in
Benefits of AWS Lambda
Amazon API Gateway: Serverless APIs
Internet
Mobile apps
Websites
Services
AWS Lambda
functions
AWS
API Gateway
cache
Endpoints on
Amazon EC2
Any other publicly
accessible endpointAmazon
CloudWatch
Amazon
CloudFrontAmazon
API Gateway
Benefits of Amazon API Gateway
Create a unified API
frontend for multiple
microservices
DDoS protection
and throttling for
your back end
Authenticate and
authorize requests
to a back end
Serverless Apps
EVENT SOURCE FUNCTION SERVICES (ANYTHING)
Changes in
data state
Requests to
endpoints
Changes in
resource state
Node
Python
Java
C# NEW!
The Serverless Chatbot
Internet
Any
Messaging
app
AWS Lambda
functions
AWS
API Gateway Other AWS
services
Any other publicly
accessible endpoint
Webhook using API Gateway & AWS Lambda
Things to Note
Intent resolution: Language understanding is handled by
the Lambda function using NLP libraries
Authentication: API Gateway authenticates the incoming
requests before passing to Lambda.
Partner integrations:
• Slack (blueprints available!)
• Twilio
• Hipchat
Building Chatbots with Serverless
1.Upload Bot code to AWS
Lambda
2.Set code to trigger when user
interacts via API Gateway
webhook
3.Integrate with Messaging
service
4.Test your chatbots
Frameworks and Integrations for Serverless
Chatbots
AWS SAM – AWS Serverless Application Model
• Specification to express a serverless chatbot application
• Helps in quickly deploying your application via
CloudFormation
Other community frameworks:
• Claudia-bot-builder – Node open source framework
• Serverless.com – Serverless framework
NEW !
AWS Slack Chatbot Hackathon Summary
• 2 months virtual
hackathon
(Aug10–Sept29 ‘16)
• 650+ registrations
• ~70 submissions
• Using various
frameworks,
libraries, open
source and more
https://awschatbot.devpost.com/submissions
Hackathon Popular Chatbot Use Cases
• ChatOps
• Education
• Social
• Translation
• Travel
• Trivia
• Polls/quiz
• Knowledge Base
• Many more…
Chatbots Architectural Recommendations
• Authentication and authorization
• Sigv4, Amazon Cognito, custom authorizers
• Lambda execution role
• Environment variables
• Encrypt your secrets
• Persistence of state & sessions
• DDB, S3, or any data store
• Reuse bot logic across messaging platforms
NEW !
Developer Challenges
Conversational interfaces need to combine a large number of
sophisticated algorithms and technologies
Business Logic
Disparate
Systems
AuthenticationSpeech
Recognition Language
UnderstandingMessaging
Platforms
Scale Testing
Security
Availability
Mobile
Amazon Lex Features
Text and speech language understanding: powered by the same technology as
Alexa
Enterprise SaaS connectors: connect to enterprise systems
Deployment to chat services
Designed for builders: efficient and intuitive tools to build
conversations; scales automatically
Versioning and alias support@
Text and Speech Language Understanding
Speech
Recognition
Natural Language
Understanding
Powered by the same Deep Learning technology as Alexa
Deployment to Chat Services
Messenger
Mobile
Card Description
Button 1
Button 2
Button 3
Card
Description
Option 1
Option 2
Authentication
Rich FormattingOne-Click Deployment
Amazon Lex
Versioning and Alias Support
AliasVersioning
• Supported for Intents, Slots, and Bots
• Enables multi-developer environment
• Roll back to previous versions
• Deploy different aliases to different platforms
• Run different stacks for dev, stage, and prod environments
• Target different user groups with different aliases
v1 v2 v3 latest
v1 Dev
v2 Stage
v3 Prod
Lex Bot Structure
Utterances
Spoken or typed phrases that invoke
your intent
BookHotel
Intents
An intent performs an action in
response to natural language user
input
Slots
Slots are input data required to fulfill
the intent
Fulfillment
Fulfillment mechanism for your intent
Utterances
I’d like to book a hotel
I want to make my hotel reservations
I want to book a hotel in New York City
Can you help me book my hotel?
Slots
destination City New York City, Seattle, London, …
Slot Type Values
Check In Date Valid dates
Check Out Date Valid dates
Slot Elicitation
I’d like to book a hotel
What date do you check in?
New York City
Sure what city do you want to book?
Nov 30th Check In
11/30/2016
City
New York City
Fulfillment
AWS Lambda
Integration
Return to
Client
User input parsed to derive
intents and slot values.
Output returned to client for
further processing.
Intents and slots passed to
AWS Lambda function for
business logic
implementation.
“Book a Hotel”
Book Hotel
NYC
“Book a Hotel in
NYC”
Hotel Booking
New York City
Natural Language
Understanding
Intent/Slot
Model
UtterancesHotel Booking
City New York City
Check In Nov 30th
Check Out Dec 2nd
“Your hotel is booked for
Nov 30th”
Confirmation: “Your hotel
is booked for Nov 30th”
“Can I go ahead
with the booking?
a
in
User
interacts with
Chabot
Confirmation
Save, Build, and Publish
Save Build
Saving your bot
preserves the current
state on the server
Building your bot
creates versions
that you can test.
Publish
Publishing your app will create a
version of your bot and provide
an alias to your clients
Test
Test your bot in a
chat window on the
Console
Amazon Lex Technology
Amazon Lex
Automatic Speech
Recognition (ASR)
Natural Language
Understanding (NLU)
Same technology that powers Alexa
Amazon Cognito CloudTrail CloudWatch
AWS Services
ActionAWS Lambda
Authentication
& Visibility
Speech
APILanguage
API
Fulfillment
End Users
Developers
Console
SDK
Intents,
Slots,
Prompts,
Utterances
Speech or
Text Input
Multi-Platform Clients:
Mobile, IoT, Web,
Chat
API
Amazon Lex Use Cases
Informational BotsChatbots for everyday consumer requests
Application BotsBuild powerful interfaces to mobile applications
• News updates
• Weather information
• Game scores ….
• Book tickets
• Order food
• Manage bank accounts ….
Enterprise Productivity BotsStreamline enterprise work activities and improve efficiencies
• Check sales numbers
• Marketing performance
• Inventory status ….
Internet of Things (IoT) BotsEnable conversational interfaces for device interactions
• Wearables
• Appliances
• Auto ….
Amazon Lex Benefits
High quality text and speech language
understanding
Built-in integration with the AWS platform
Seamlessly deploy and scale
Easy to use
Cost-effective
AWS Mobile Hub Integration
Authenticate users
Analyze user behavior
Store and share media
Synchronize data
More ….Track retention
Conversational BotsLexAWS Mobile SDKs
AWS Mobile Hub
Enterprise SaaS Connectors with Mobile Hub
Mobile Hub
SaaS Connector
Amazon API
Gateway
AWS
Lambda
Amazon API
GatewayAWS
Lambda
Mobile Hub
Custom Connector
Mobile App Amazon Lex
AWS
Lambda
Business
Application
Firewall
Enterprise SaaS Connectors with Mobile Hub
Amazon Lex
Mobile App
Mobile Hub
SaaS Connector
Amazon API
Gateway
AWS
Lambda
1: Understand
user intent
Amazon API
Gateway
AWS
Lambda
3: Translate
REST response
into natural
languageMobile Hub
Custom Connector
2: Invoke a SaaS
application or an existing
business application
Business
Application
Firewall
User Input
Recap
• First, we looked into creating chatbots as serverless
webhooks using AWS Lambda and API Gateway
• Next, we added natural language intelligence to your
chatbots using Amazon Lex and AWS Lambda
• Finally, we looked at mobile hub integration and
enterprise SaaS connectors to enrich your chatbot with
enterprise data
Key Takeaway: Register for the Preview @
aws.amazon.com/lex
Sign-Up & Whitelist
Build your first serverless chatbot using samples in
Lex and Lambda blueprints!
✔✔✔