SlideShare a Scribd company logo
1 of 108
Download to read offline
Building a chatbot – step by step
Srushith R
srushith@codeops.tech
What is this bot all about?
• This is a bot for buying books – ‘Amazon
BookBot’
• You can interact with this bot to find out
relevant technical books on the given topic
available in Amazon
• For each book, you can find out book details
(author, price, reviews, availability, etc.)
• This bot can be integrated with
FaceBook/Slack
Technologies
• Amazon Web Services
– AWS Lex – for Natural Language Processing (NLP)
– AWS Lambda – for the back-end serverless
function(s)
• Python 2.7 – for the serverless function code
– python-amazon-simple-product-api 2.2.11 - A
Python wrapper for the Amazon.com Product
Advertising API (for getting book information from
Amazon)
Installation (for hands-on)
• AWS account
– Preferably AWS CLI installed
• Python 2.7 installed
• Python module installed: python-amazon-
simple-product-api 2.2.11
Note: The Python module and the source code
must be available in the same folder (for
uploading into AWS Lambda)
Roadmap
1. Write a python code to get book details given
a keyword from Amazon
2. Create a Lambda function
3. Create a chat bot using AWS Lex
4. Integrate with facebook
Getting started
• The core functionality of fetching the details
of book(s) given the keyword can be
implemented as a simple Python code first
– This will reduce your effort in coding, debugging
and testing your Python code
– The same functionality can be integrated as an
AWS Lambda function later
– Here is the sample code with its invocation sample
as an example
Python code
Output
$ python books.py
1 The DevOps Handbook: How to Create World-Class Agility, Reliability, and Security in
Technology Organizations
2 The Phoenix Project: A Novel about IT, DevOps, and Helping Your Business Win
3 What is DevOps?
4 DevOps Handbook: A Guide To Implementing DevOps In Your Workplace
5 The DevOps 2.0 Toolkit: Automating the Continuous Deployment Pipeline with
Containerized Microservices
6 Building a DevOps Culture
7 The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win
8 The DevOps 2.1 Toolkit: Docker Swarm: Building, testing, deploying, and monitoring
services inside Docker Swarm clusters (The DevOps Toolkit Series) (Volume 2)
9 5 Unsung Tools of DevOps
10 Effective DevOps: Building a Culture of Collaboration, Affinity, and Tooling at Scale
Tweak the code
• Regardless of the language you choose, there
is a common pattern to writing code for a
Lambda function that includes the following
core concepts:
– Handler: Handler is the function AWS Lambda
calls to start execution of your Lambda function
– The context object: Via context object your code
can interact with AWS Lambda
Lets log!
• Add logging statements to the Python code to
see what exactly is happening in the
background. There are two ways to log:
– Use of print statements: all print statements are
by default logged into CloudWatch
– Use ‘logging’ module in python: logging.*
functions write additional information to each log
entry, such as time stamp and log level.
IAM role for logging
• IAM (Identity & Access Management) role is
similar to an user, in that it is an AWS identity
with permission policies that determine what
the identity can and cannot do in AWS
• It is a service that logs AWS events made by or
on behalf of your AWS account
• Create an IAM role to be used for logging.
– You should permit this role to log the data
Create an IAM role
Select IAM in the AWS services and select roles
Create an IAM role
Create an IAM role
select AWS
Lambda
Add policies to the role
add
AWSLambdaExecute and
AWSLambda FullAccess
policies to the role
Create an IAM role
IAM role
Changed code (for logging)
Create a Lambda function
Select a runtime and blueprint
Create Lambda function
inline code editing tab.
If the code is simple
(without any
dependencies), you can
add it here
Configure triggers
can choose any of
the triggers, but we
don’t require any in
this example
Folder with the dependencies
code with dependencies
must be uploaded as a
zip file with all the
necessary dependencies
Folder with the dependencies and the
source code
Zip them
The resulting zip file
Upload the zip file
Add environment variables
Specify the lambda handler and
choose a role for logging
handler format:
<Source code file
name>.lambda_handler
role with logging
permissions
Set the timeout
maximum
runtime of the
lambda function
Review the details
Review the details and create
Test the Lambda function
Configure the input test event
Save and test!
Lambda function output
Log output
Amazon Lex
Creating a bot using Lex
Creating bot using Lex
Add the bot details
maximum
inactive time
Create intent
create an
intent
Create intent
Create intent
Create intent
Utterances
add preferred
utterances – purchase
a <docker> book
Add Slots
add slots
Choose a Slot type
you can choose from
the existing templates
or create your own
slot type
Add Prompts
prompts are questions to
the users that help in
filling the slots
the moment slot ‘title’ is
entered, Lex recognises
it in the utterances
select if the
particular slot is a
compulsory one
Integrate Lex and Lambda
select the desired
lambda function
from the drop
down
Add permission
Save and build
Build
Its up and ready!
Lets test!
Oops!
Lets interrogate – check logs on
CloudWatch
But this is what we got:
Expected input:
{
“title” : “java”
}
{u'currentIntent': {u'slots': {u'title': u'java'}, u'name': u'get_book_titles',
u'confirmationStatus': u'None'}, u'bot': {u'alias': None, u'version': u'$LATEST', u'name':
u'BookBot'}, u'userId': u'dmfh3duubfag9vpt9a6va3sj153hfj70', u'inputTranscript':
u'suggest a java book', u'invocationSource': u'FulfillmentCodeHook',
u'outputDialogMode': u'Text', u'messageVersion': u'1.0', u'sessionAttributes': None}
How Lex communicates?
• Lex doesn’t just send the slot data, it sends much
more!
– currentIntent: has slots, name (the intent name) and
confirmationStatus
– bot:
• name – The name of the bot that processed the request
• alias – The alias of the bot version that processed the request.
• version – The version of the bot that processed the request.
– userId : This value is provided by the client application.
Amazon Lex passes it to the Lambda function.
– inputTranscript: The text used to process the request.
How Lex communicates?
• invocationSource:
– DialogCodeHook: Amazon Lex sets this value to
direct the Lambda function to initialize the
function and to validate the user's data input
– FulfillmentCodeHook: Amazon Lex sets this value
to direct the Lambda function to fulfill an intent.
• sessionAttributes: Application-specific session
attributes that the client sent in the request.
This plays an important role for conversational
bots, where a state has to be maintained
Change the code, again!
Test at the lambda end
Zip the folder with the dependencies again with the
updated code and test with the input:
Fingers crossed!
The output at the lambda console:
Lets test from the bot
Why me?
Current scenario
But why?
This is the reason:
Lex Lambda
Lex expects a particular format
Amazon Lex expects a response from a Lambda function in the
following format:
Lambda response format for Lex
• sessionAttributes: This field is optional
• dialogAction : The dialogAction field directs Amazon Lex to
the next course of action, and describes what to expect from
the user after Amazon Lex returns a response to the client.
The type field indicates the next course of action
– Close — Informs Amazon Lex not to expect a response
from the user
– ConfirmIntent — Informs Amazon Lex that the user is
expected to give a yes or no answer to confirm or deny the
current intent.
– Delegate — Directs Amazon Lex to choose the next course
of action based on the bot configuration.
Lambda response format for Lex
– ElicitIntent — Informs Amazon Lex that the user is
expected to respond with an utterance that
includes an intent
– ElictSlot — Informs Amazon Lex that the user is
expected to provide a slot value in the response
dialogAction - close
dialogAction - ConfirmIntent
dialogAction - delegate
dialogAction - ElicitIntent
dialogAction - ElicitSlot
Code change, one last time
Phew!
Integration with facebook
Integration with facebook
On the Facebook developer portal, create a
Facebook application and a Facebook page.
–App Secret for the Facebook App.
–Page Access Token for the Facebook page.
Create a facebook page
Facebook page
Facebook page - AmazonBooks
Create a facebook app
facebook developer portal
Create a new app
Security check
Facebook app - AmazonBot
Choose Messenger
Facebook Messenger platform
Generate page access token
Select the facebook page from the drop down
Allow permissions
Approve!
Page access token
Note down the page access token
Facebook app secret
Click on the dashboard to get the app secret
Connecting Lex and facebook
Channels in Lex
In AWS Lex, select the channels tab and fill in the details
for facebook integration
Aliases
An alias is a pointer to a specific version of an Amazon Lex bot.
Use an alias to allow client applications to use a specific version
of the bot without requiring the application to track which
version that is.
Go to the settings tab of AWS Lex and add a name and version
(Latest by default) and click on the add button
Add the details
verify token is used
for handshake
between Lex and
facebook
add the pre noted
page access token
and app secret
Callback URL
A callback URL is generated once the bot is activated. This URL is
used as the webhook URL at the facebook end
Webhook setup
Webhook setup
callback URL
and the same
verify token
from the Lex
end
Select messages,
messagin_postbacks
and messging_options
Subscribe the facebook page
select the facebook
(AmazonBooks) page
from the drop down
Subscribe the facebook page
Search for the facebook page in the
chat
Search for the page
in the chat or at
messenger.com
Finally!
Hooray!
• Check out www.CodeOps.tech/meetup for
upcoming meetups

More Related Content

What's hot

The dark side of Akka and the remedy
The dark side of Akka and the remedyThe dark side of Akka and the remedy
The dark side of Akka and the remedykrivachy
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN StackTroy Miles
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentationGene Chang
 
Developing distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterDeveloping distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterKonstantin Tsykulenko
 
Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Jose Luis Martínez
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinayViplav Jain
 
Actor Clustering with Docker Containers and Akka.Net in F#
Actor Clustering with Docker Containers and Akka.Net in F#Actor Clustering with Docker Containers and Akka.Net in F#
Actor Clustering with Docker Containers and Akka.Net in F#Riccardo Terrell
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsSadayuki Furuhashi
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupRoy Russo
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play frameworkFelipe
 
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesUnderstanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesLightbend
 
2014-02-20 | Akka Concurrency (Vienna Scala User Group)
2014-02-20 | Akka Concurrency (Vienna Scala User Group)2014-02-20 | Akka Concurrency (Vienna Scala User Group)
2014-02-20 | Akka Concurrency (Vienna Scala User Group)Dominik Gruber
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxClaus Ibsen
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Konrad Malawski
 
The dark side of Akka and the remedy - bp.scala meetup
The dark side of Akka and the remedy - bp.scala meetupThe dark side of Akka and the remedy - bp.scala meetup
The dark side of Akka and the remedy - bp.scala meetupkrivachy
 
Http programming in play
Http programming in playHttp programming in play
Http programming in playKnoldus Inc.
 
Gatling @ Scala.Io 2013
Gatling @ Scala.Io 2013Gatling @ Scala.Io 2013
Gatling @ Scala.Io 2013slandelle
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sOrtus Solutions, Corp
 

What's hot (20)

The dark side of Akka and the remedy
The dark side of Akka and the remedyThe dark side of Akka and the remedy
The dark side of Akka and the remedy
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentation
 
Developing distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterDeveloping distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka Cluster
 
Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
Actor Clustering with Docker Containers and Akka.Net in F#
Actor Clustering with Docker Containers and Akka.Net in F#Actor Clustering with Docker Containers and Akka.Net in F#
Actor Clustering with Docker Containers and Akka.Net in F#
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users Group
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
 
Alteryx SDK
Alteryx SDKAlteryx SDK
Alteryx SDK
 
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesUnderstanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
 
2014-02-20 | Akka Concurrency (Vienna Scala User Group)
2014-02-20 | Akka Concurrency (Vienna Scala User Group)2014-02-20 | Akka Concurrency (Vienna Scala User Group)
2014-02-20 | Akka Concurrency (Vienna Scala User Group)
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the box
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
 
The dark side of Akka and the remedy - bp.scala meetup
The dark side of Akka and the remedy - bp.scala meetupThe dark side of Akka and the remedy - bp.scala meetup
The dark side of Akka and the remedy - bp.scala meetup
 
Http programming in play
Http programming in playHttp programming in play
Http programming in play
 
Gatling @ Scala.Io 2013
Gatling @ Scala.Io 2013Gatling @ Scala.Io 2013
Gatling @ Scala.Io 2013
 
Actor Model Akka Framework
Actor Model Akka FrameworkActor Model Akka Framework
Actor Model Akka Framework
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api's
 

Similar to Build a Chatbot Step-by-Step Guide

Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017
Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017
Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017Amazon Web Services
 
WIN205-Building a Better .NET Bot with AWS Services
WIN205-Building a Better .NET Bot with AWS ServicesWIN205-Building a Better .NET Bot with AWS Services
WIN205-Building a Better .NET Bot with AWS ServicesAmazon Web Services
 
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...Amazon Web Services
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAmazon Web Services
 
Aws meetup building_lambda
Aws meetup building_lambdaAws meetup building_lambda
Aws meetup building_lambdaAdam Book
 
Alexa101 course slides
Alexa101 course slidesAlexa101 course slides
Alexa101 course slidesDan Bloy
 
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless CloudAWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
A Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaA Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaAmazon Web Services
 
Serverless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemServerless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemAmazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudAmazon Web Services
 
Introduction to Aws lambda and build first application | Namespace IT
Introduction to Aws lambda and build first application | Namespace ITIntroduction to Aws lambda and build first application | Namespace IT
Introduction to Aws lambda and build first application | Namespace ITnamespaceit
 
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28Amazon Web Services
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapDaniel Zivkovic
 

Similar to Build a Chatbot Step-by-Step Guide (20)

Chatbots with Serverless
Chatbots with ServerlessChatbots with Serverless
Chatbots with Serverless
 
Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017
Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017
Building a Better .NET Bot with AWS Services - WIN205 - re:Invent 2017
 
WIN205-Building a Better .NET Bot with AWS Services
WIN205-Building a Better .NET Bot with AWS ServicesWIN205-Building a Better .NET Bot with AWS Services
WIN205-Building a Better .NET Bot with AWS Services
 
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless Cloud
 
Aws meetup building_lambda
Aws meetup building_lambdaAws meetup building_lambda
Aws meetup building_lambda
 
Alexa101 course slides
Alexa101 course slidesAlexa101 course slides
Alexa101 course slides
 
Lambda lambda-lambda
Lambda lambda-lambdaLambda lambda-lambda
Lambda lambda-lambda
 
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless CloudAWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
 
A Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaA Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS Lambda
 
Serverless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemServerless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat System
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Serverless computing
Serverless computingServerless computing
Serverless computing
 
Deep Dive on Serverless Stack
Deep Dive on Serverless StackDeep Dive on Serverless Stack
Deep Dive on Serverless Stack
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Introduction to Aws lambda and build first application | Namespace IT
Introduction to Aws lambda and build first application | Namespace ITIntroduction to Aws lambda and build first application | Namespace IT
Introduction to Aws lambda and build first application | Namespace IT
 
Deep Dive on AWS Lambda
Deep Dive on AWS LambdaDeep Dive on AWS Lambda
Deep Dive on AWS Lambda
 
The serverless LAMP stack
The serverless LAMP stackThe serverless LAMP stack
The serverless LAMP stack
 
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
 

More from CodeOps Technologies LLP

AWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetupAWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetupCodeOps Technologies LLP
 
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONSBUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONSCodeOps Technologies LLP
 
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICESAPPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICESCodeOps Technologies LLP
 
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPSBUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPSCodeOps Technologies LLP
 
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNERCREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNERCodeOps Technologies LLP
 
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...CodeOps Technologies LLP
 
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESSWRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESSCodeOps Technologies LLP
 
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh SharmaTraining And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh SharmaCodeOps Technologies LLP
 
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaDeploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaCodeOps Technologies LLP
 
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...CodeOps Technologies LLP
 
YAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra KhareYAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra KhareCodeOps Technologies LLP
 
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...CodeOps Technologies LLP
 
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaMonitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaCodeOps Technologies LLP
 
Functional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and StreamsFunctional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and StreamsCodeOps Technologies LLP
 
Distributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps FoundationDistributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps FoundationCodeOps Technologies LLP
 
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire  "Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire CodeOps Technologies LLP
 

More from CodeOps Technologies LLP (20)

AWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetupAWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetup
 
Understanding azure batch service
Understanding azure batch serviceUnderstanding azure batch service
Understanding azure batch service
 
DEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNINGDEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNING
 
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONSSERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
 
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONSBUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
 
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICESAPPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
 
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPSBUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
 
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNERCREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
 
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
 
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESSWRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
 
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh SharmaTraining And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
 
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaDeploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
 
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
 
YAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra KhareYAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra Khare
 
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
 
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaMonitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
 
Jet brains space intro presentation
Jet brains space intro presentationJet brains space intro presentation
Jet brains space intro presentation
 
Functional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and StreamsFunctional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and Streams
 
Distributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps FoundationDistributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps Foundation
 
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire  "Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
 

Recently uploaded

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 

Recently uploaded (20)

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 

Build a Chatbot Step-by-Step Guide

  • 1. Building a chatbot – step by step Srushith R srushith@codeops.tech
  • 2. What is this bot all about? • This is a bot for buying books – ‘Amazon BookBot’ • You can interact with this bot to find out relevant technical books on the given topic available in Amazon • For each book, you can find out book details (author, price, reviews, availability, etc.) • This bot can be integrated with FaceBook/Slack
  • 3. Technologies • Amazon Web Services – AWS Lex – for Natural Language Processing (NLP) – AWS Lambda – for the back-end serverless function(s) • Python 2.7 – for the serverless function code – python-amazon-simple-product-api 2.2.11 - A Python wrapper for the Amazon.com Product Advertising API (for getting book information from Amazon)
  • 4. Installation (for hands-on) • AWS account – Preferably AWS CLI installed • Python 2.7 installed • Python module installed: python-amazon- simple-product-api 2.2.11 Note: The Python module and the source code must be available in the same folder (for uploading into AWS Lambda)
  • 5. Roadmap 1. Write a python code to get book details given a keyword from Amazon 2. Create a Lambda function 3. Create a chat bot using AWS Lex 4. Integrate with facebook
  • 6. Getting started • The core functionality of fetching the details of book(s) given the keyword can be implemented as a simple Python code first – This will reduce your effort in coding, debugging and testing your Python code – The same functionality can be integrated as an AWS Lambda function later – Here is the sample code with its invocation sample as an example
  • 8. Output $ python books.py 1 The DevOps Handbook: How to Create World-Class Agility, Reliability, and Security in Technology Organizations 2 The Phoenix Project: A Novel about IT, DevOps, and Helping Your Business Win 3 What is DevOps? 4 DevOps Handbook: A Guide To Implementing DevOps In Your Workplace 5 The DevOps 2.0 Toolkit: Automating the Continuous Deployment Pipeline with Containerized Microservices 6 Building a DevOps Culture 7 The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win 8 The DevOps 2.1 Toolkit: Docker Swarm: Building, testing, deploying, and monitoring services inside Docker Swarm clusters (The DevOps Toolkit Series) (Volume 2) 9 5 Unsung Tools of DevOps 10 Effective DevOps: Building a Culture of Collaboration, Affinity, and Tooling at Scale
  • 9.
  • 10. Tweak the code • Regardless of the language you choose, there is a common pattern to writing code for a Lambda function that includes the following core concepts: – Handler: Handler is the function AWS Lambda calls to start execution of your Lambda function – The context object: Via context object your code can interact with AWS Lambda
  • 11. Lets log! • Add logging statements to the Python code to see what exactly is happening in the background. There are two ways to log: – Use of print statements: all print statements are by default logged into CloudWatch – Use ‘logging’ module in python: logging.* functions write additional information to each log entry, such as time stamp and log level.
  • 12. IAM role for logging • IAM (Identity & Access Management) role is similar to an user, in that it is an AWS identity with permission policies that determine what the identity can and cannot do in AWS • It is a service that logs AWS events made by or on behalf of your AWS account • Create an IAM role to be used for logging. – You should permit this role to log the data
  • 13. Create an IAM role Select IAM in the AWS services and select roles
  • 15. Create an IAM role select AWS Lambda
  • 16. Add policies to the role add AWSLambdaExecute and AWSLambda FullAccess policies to the role
  • 19. Changed code (for logging)
  • 20.
  • 21. Create a Lambda function
  • 22. Select a runtime and blueprint
  • 23. Create Lambda function inline code editing tab. If the code is simple (without any dependencies), you can add it here
  • 24. Configure triggers can choose any of the triggers, but we don’t require any in this example
  • 25. Folder with the dependencies code with dependencies must be uploaded as a zip file with all the necessary dependencies
  • 26. Folder with the dependencies and the source code
  • 31. Specify the lambda handler and choose a role for logging handler format: <Source code file name>.lambda_handler role with logging permissions
  • 32. Set the timeout maximum runtime of the lambda function
  • 34. Review the details and create
  • 35. Test the Lambda function
  • 36. Configure the input test event
  • 41. Creating a bot using Lex
  • 43. Add the bot details maximum inactive time
  • 48. Utterances add preferred utterances – purchase a <docker> book
  • 50. Choose a Slot type you can choose from the existing templates or create your own slot type
  • 51. Add Prompts prompts are questions to the users that help in filling the slots
  • 52. the moment slot ‘title’ is entered, Lex recognises it in the utterances select if the particular slot is a compulsory one
  • 53. Integrate Lex and Lambda select the desired lambda function from the drop down
  • 56. Build
  • 57. Its up and ready!
  • 59. Oops!
  • 60. Lets interrogate – check logs on CloudWatch But this is what we got: Expected input: { “title” : “java” } {u'currentIntent': {u'slots': {u'title': u'java'}, u'name': u'get_book_titles', u'confirmationStatus': u'None'}, u'bot': {u'alias': None, u'version': u'$LATEST', u'name': u'BookBot'}, u'userId': u'dmfh3duubfag9vpt9a6va3sj153hfj70', u'inputTranscript': u'suggest a java book', u'invocationSource': u'FulfillmentCodeHook', u'outputDialogMode': u'Text', u'messageVersion': u'1.0', u'sessionAttributes': None}
  • 61. How Lex communicates? • Lex doesn’t just send the slot data, it sends much more! – currentIntent: has slots, name (the intent name) and confirmationStatus – bot: • name – The name of the bot that processed the request • alias – The alias of the bot version that processed the request. • version – The version of the bot that processed the request. – userId : This value is provided by the client application. Amazon Lex passes it to the Lambda function. – inputTranscript: The text used to process the request.
  • 62. How Lex communicates? • invocationSource: – DialogCodeHook: Amazon Lex sets this value to direct the Lambda function to initialize the function and to validate the user's data input – FulfillmentCodeHook: Amazon Lex sets this value to direct the Lambda function to fulfill an intent. • sessionAttributes: Application-specific session attributes that the client sent in the request. This plays an important role for conversational bots, where a state has to be maintained
  • 64. Test at the lambda end Zip the folder with the dependencies again with the updated code and test with the input:
  • 65. Fingers crossed! The output at the lambda console:
  • 66. Lets test from the bot
  • 69. But why? This is the reason: Lex Lambda
  • 70. Lex expects a particular format Amazon Lex expects a response from a Lambda function in the following format:
  • 71. Lambda response format for Lex • sessionAttributes: This field is optional • dialogAction : The dialogAction field directs Amazon Lex to the next course of action, and describes what to expect from the user after Amazon Lex returns a response to the client. The type field indicates the next course of action – Close — Informs Amazon Lex not to expect a response from the user – ConfirmIntent — Informs Amazon Lex that the user is expected to give a yes or no answer to confirm or deny the current intent. – Delegate — Directs Amazon Lex to choose the next course of action based on the bot configuration.
  • 72. Lambda response format for Lex – ElicitIntent — Informs Amazon Lex that the user is expected to respond with an utterance that includes an intent – ElictSlot — Informs Amazon Lex that the user is expected to provide a slot value in the response
  • 78. Code change, one last time
  • 79. Phew!
  • 81. Integration with facebook On the Facebook developer portal, create a Facebook application and a Facebook page. –App Secret for the Facebook App. –Page Access Token for the Facebook page.
  • 84. Facebook page - AmazonBooks
  • 85. Create a facebook app facebook developer portal
  • 88. Facebook app - AmazonBot
  • 91. Generate page access token Select the facebook page from the drop down
  • 94. Page access token Note down the page access token
  • 95. Facebook app secret Click on the dashboard to get the app secret
  • 96. Connecting Lex and facebook
  • 97. Channels in Lex In AWS Lex, select the channels tab and fill in the details for facebook integration
  • 98. Aliases An alias is a pointer to a specific version of an Amazon Lex bot. Use an alias to allow client applications to use a specific version of the bot without requiring the application to track which version that is. Go to the settings tab of AWS Lex and add a name and version (Latest by default) and click on the add button
  • 99. Add the details verify token is used for handshake between Lex and facebook add the pre noted page access token and app secret
  • 100. Callback URL A callback URL is generated once the bot is activated. This URL is used as the webhook URL at the facebook end
  • 102. Webhook setup callback URL and the same verify token from the Lex end Select messages, messagin_postbacks and messging_options
  • 103. Subscribe the facebook page select the facebook (AmazonBooks) page from the drop down
  • 105. Search for the facebook page in the chat Search for the page in the chat or at messenger.com
  • 108. • Check out www.CodeOps.tech/meetup for upcoming meetups