Hands-On Chatbot Development with Alexa Skills and Amazon Lex
上QQ阅读APP看书,第一时间看更新

Triggering Lambdas

In your first Lambda, the way that we tested it was by triggering it with a test. To make Lambdas useful, we need to be able to trigger it from different places.

In the Lambda Console, near the top, there is a Designer section. This section allows you to change how the Lambda interacts with other services and therefore the user. On the left of the section is an Add triggers menu with a selection of options. Each of these is a system of services that you can set up to trigger the function. These are not all of the ways to trigger a Lambda and we'll be using other methods in the future.

The most important ones for us are API Gateway and Alexa Skill Kit, but the other triggers can be very useful for other projects. API Gateway is the way to expose the Lambda to the outside world. You create an API endpoint, and anyone can hit that endpoint and that data will be processed by your Lambda. We'll be creating an API in Chapter 7, Publishing Your Chatbot to Facebook, Slack, Twilio and HTTP. The Alexa Skill Kit is a service for building Alexa Skills and these can trigger Lambdas too, and we'll be doing this in the next chapter.