Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Chatbot Development with Alexa Skills and Amazon Lex

You're reading from   Hands-On Chatbot Development with Alexa Skills and Amazon Lex Create custom conversational and voice interfaces for your Amazon Echo devices and web platforms

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781788993487
Length 266 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Sam Williams Sam Williams
Author Profile Icon Sam Williams
Sam Williams
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Understanding Chatbots FREE CHAPTER 2. Getting Started with AWS and Amazon CLI 3. Creating Your First Alexa Skill 4. Connecting Your Alexa Skills to External APIs 5. Building Your First Amazon Lex Chatbot 6. Connecting a Lex Bot to DynamoDB 7. Publishing Your Chatbot to Facebook, Slack, Twilio, and HTTP 8. Improving the User Experience for Your Bots 9. Review and Continued Development 10. Other Books You May Enjoy Appendix A 1. Appendix B

Creating the Lambda

Now that we have done the console setup, we can build the Lambda that will handle the logic behind the skill.

Start by creating a new folder in your lambdas folder, naming it something appropriate, such as carHelper. Inside, we need to create an index.js file and run npm init. We are using alexa-sdk again so we need to run npm install --save alexa-sdk.

With the setup ready, we can start writing the Lambda. We can start with a Lambda that looks very similar to the Lambda we created in our first function:

const Alexa = require('alexa-sdk');

exports.handler = Alexa.SkillBuilders.custom()
.addRequestHandlers()
.lambda();

The first handler we are going to create is to handle a launch request. This is when a user says something like "Alexa start car helper"; our skill is launched but no intent is triggered. We need to help them trigger one...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image