Hands-On Chatbot Development with Alexa Skills and Amazon Lex

Book description

Build artificial intelligence (AI) powered voice and text conversational interfaces with Amazon

Key Features

  • Develop Alexa Skills to create a working voice user interface (VUI)
  • Integrate Amazon Lex chatbots into Facebook, Slack, and text messages
  • Learn to use AWS Lambda, Alexa Skills Kit, and Amazon Lex

Book Description

Have you ever wondered how Alexa apps are made, how voice-enabled technologies work, or how chatbots function? And why tech giants such as Amazon and Google are investing in voice technologies? A better question is: why should I start developing on these platforms? Hands-On Chatbot Development with Alexa Skills and Amazon Lex covers all features of the Alexa Skills kit with real-world examples that help you develop skills to integrate Echo and chatbots into Facebook, Slack, and Twilio with the Amazon Lex platform.

The book starts with teaching you how to set up your local environment and AWS CLI so that you can automate the process of uploading AWS Lambda from your local machine. You will then learn to develop Alexa Skills and Lex chatbots using Lambda functions to control functionality. Once you've come to grips with this, you will learn to create increasingly complex chatbots, integrate Amazon S3, and change the way Alexa talks to the user. In the concluding chapters, we shift our focus to Amazon Lex and messaging chatbots. We will explore Alexa, learn about DynamoDB databases, and add cards to user conversations.

By the end of this book, you will have explored a full set of technologies that will enable you to create your own voice and messaging chatbots using Amazon.

What you will learn

  • Create a development environment using Alexa Skills Kit, AWS CLI, and Node.js
  • Build Alexa Skills and Lex chatbots from scratch
  • Gain access to third-party APIs from your Alexa Skills and Lex chatbots
  • Use AWS services such as Amazon S3 and DynamoDB to enhance the abilities of your Alexa Skills and Amazon Lex chatbots
  • Publish a Lex chatbot to Facebook Messenger, Twilio SMS, and Slack
  • Create a custom website for your Lex chatbots
  • Develop your own skills for Alexa-enabled devices such as the Echo

Who this book is for

Hands-On Chatbot Development with Alexa Skills and Amazon Lex is for developers who are interested in building conversational bots and Alexa skills with Amazon. Prior experience with JavaScript programming is required.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Hands-On Chatbot Development with Alexa Skills and Amazon Lex
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Understanding Chatbots
    1. What are chatbots?
    2. What makes up a chatbot?
      1. Intents
      2. Slots
      3. Utterances
    3. Designing conversation flows
      1. Starting with the perfect conversation diagram
      2. Conversation flow diagrams
      3. Creating a conversation flow diagram
      4. User stories
    4. Best practices
      1. Handling errors
        1. Missed utterances
        2. External APIs
        3. Errors in your code
      2. Tone of voice
      3. Identifying suitable use cases
      4. Designing the information for the delivery method
    5. Amazon Alexa and Lex
      1. Amazon Alexa
      2. Amazon Lex
    6. Summary
    7. Questions
  7. Getting Started with AWS and Amazon CLI
    1. Technical requirements
    2. Creating an account
      1. Setting your region
      2. Navigating around AWS
    3. Creating a Lambda
      1. AWS Console
      2. Setting up the Lambda
      3. Writing your Lambda function's code
      4. Triggering Lambdas
    4. Methods for working with Lambdas
      1. Method 1 – Lambda Console
      2. Method 2 – Cloud9 editor
      3. Method 3 – Local editing
    5. Creating the best local development environment
      1. Choosing an IDE
      2. Installing Node and NPM
      3. Folder structure
      4. Setting up AWS CLI
      5. Creating a Lambda using AWS CLI
      6. AWS CLI build script
      7. Git
      8. Local development setup
    6. Summary
    7. Questions
  8. Creating Your First Alexa Skill
    1. Technical requirements
    2. Alexa Skills Kit
    3. Creating a Lambda to handle the request
      1. Creating handlers
      2. Building and configuring the Lambda
      3. Finishing skill configuration
    4. Testing your skills
      1. Troubleshooting your skill
    5. Creating a more useful skill
    6. Conversational flow diagram
      1. Creating the Alexa Skill
        1. Creating an Intent
      2. Internal Slots
      3. Finding the Skill ID
    7. Creating the Lambda
      1. Handling the whichCar Intent
      2. Amazon S3
      3. Accessing our S3 data
        1. Adding S3 permissions
        2. Dealing with our data
        3. Testing our Lambda
      4. Finishing the Alexa Skills Kit Configuration
        1. Testing
    8. Launching your skill
    9. Summary
    10. Questions
    11. Further reading
  9. Connecting Your Alexa Skills to External APIs
    1. Technical requirements
    2. External APIs
      1. Open Weather Map API
    3. Creating our weather skill
      1. Conversation flow design
      2. Creating the skill on Alexa Skills Kit
      3. Building Lambda to handle the requests
      4. Making an API request
      5. Final setup and testing
    4. Improving user experience
      1. Error-handling our API calls
      2. Session memory
      3. SSML
      4. Testing
    5. Summary
    6. Questions
    7. Further reading
  10. Building Your First Amazon Lex Chatbot
    1. Technical requirements
    2. Creating an Amazon Lex chatbot
      1. Setting up the chatbot
      2. Creating an Intent
      3. Testing your chatbot
      4. Publishing your bot
      5. Using Slots
    3. Creating an FAQ chatbot
      1. Setting up Lex
      2. Gathering the data
      3. Creating the Intents
      4. Creating the Lambda Handler
      5. Creating a response
      6. Lambda fulfillment
      7. Building and testing
    4. Lex responses
      1. elicitSlot
      2. elicitIntent
      3. confirmIntent
      4. close
      5. delegate
    5. Summary
    6. Questions
  11. Connecting a Lex Bot to DynamoDB
    1. Technical requirements
    2. Designing the flows
      1. Perfect conversations
      2. Flow diagrams
    3. Building the chatbot
      1. Product find
        1. Creating the Lambda
        2. Creating the data
        3. Lambda testing
        4. Completing the intent
      2. Add to cart
        1. Creating the Lambda
        2. DynamoDB
        3. Adding Dynamo permissions
        4. Testing
      3. Checkout
        1. Creating the Lambda
        2. Testing
      4. Saving our cart
        1. Creating the Lambda
        2. Dynamo changes
        3. Testing
      5. Retrieving a saved cart
        1. Creating the Lambda
        2. Testing
      6. What's in my cart?
        1. Creating the Lambda
        2. Testing
    4. Testing the whole bot
    5. Summary
    6. Questions
    7. Further reading
  12. Publishing Your Chatbot to Facebook, Slack, Twilio, and HTTP
    1. Technical requirements
    2. Integrations
      1. Facebook Messenger
        1. Creating and connecting a Facebook Messenger app
      2. Slack
        1. Creating and connecting a Slack app
      3. Twilio
        1. Creating and connecting Twilio
    3. HTTP endpoint
      1. Creating the Lambda
        1. Testing
      2. Connecting API Gateway
        1. Testing
        2. Building the API
    4. Web user interface
      1. HTML
      2. Creating our script
      3. Styling the frontend
    5. Summary
    6. Questions
  13. Improving the User Experience for Your Bots
    1. Technical requirements
    2. Response cards in Amazon Lex
      1. Creating a card
      2. Using cards in chats
    3. Alexa search queries
      1. Google Cloud Platform
      2. Continuing Lambda building
      3. Rebuilding the skill and testing
    4. Lex utterance monitoring
    5. Summary
    6. Questions
  14. Review and Continued Development
    1. What we've learned
      1. Conversation design
      2. Amazon Web Services
      3. Amazon Alexa
      4. Amazon S3
      5. Using APIs
      6. Amazon Lex
      7. Dynamo DB
      8. Publishing Lex chatbots
      9. Advanced features
    2. Continuing your learning
      1. Alexa
        1. Amazon Echo Spot and Amazon Echo Show
        2. Building a library of functions
      2. Lex
      3. Alexa and Lex
        1. Improving the build process
        2. Integrating more AWS services
        3. Integrating other APIs
    3. The future of chatbots
      1. Language understanding
      2. Working with spoken interactions
      3. Improved device interaction
      4. Connected devices
      5. Unique voice-based systems
      6. General Artificial Intelligence
      7. Improving people's opinions
    4. Summary
  15. Appendix A
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
  16. Appendix B
    1. Debugging
    2. Debugging Alexa Skills
      1. Check the utterances
      2. Save and build your model
      3. Check your Endpoint
      4. Added Alexa as a trigger for your Lambda
    3. Debugging Lex chatbots
      1. Check your utterances
      2. Check the intent response
      3. Save intents, build, and deploy
      4. Check your connected platform
      5. Check your Lambdas are working
    4. Debugging Lambdas
      1. Install all of the required packages
      2. Check your permissions
      3. Correct your Lambda code
      4. Check external services
  17. Other Books You May Enjoy
    1. Leave a review – let other readers know what you think

Product information

  • Title: Hands-On Chatbot Development with Alexa Skills and Amazon Lex
  • Author(s): Sam Williams
  • Release date: September 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788993487