Posted in Alexa, Alexa Lambda Function Skill, Amazon Web Service, AWS, JSON, Node.js

Create a custom Alexa Lambda Function Skill

 

  1. Login to Amazon Developer account, Navigate to “AWS Lambda”; then create a new Lambda function using a blueprint with code for the basic functions that implements a simple skill in Node.js or Python. To start with sample code, click Blueprints, then select one of the skill kits, for instance “alexa-skills-kit-color-expert”
  2. Then Enter a “name” for the function.
  3. Select the “Role”, use the role under “Existing role”.
  4. and then “Create function”.
  5. This will create a sample that we can edit later as needed.

 

Then in another browser login to your “AWS Management Console” and navigate to AWS Lambda.

  • Select “US East (N. Virginia) Region on upper-right corner of the console.

8

  • Select “Enable” for Skill ID Verification.

9

  • And copy the Skill ID from Developer Console > Your Skills > Skill-Name> Endpoint tab>

4

and past it into the Skill ID edit box as shown below:

9

  • Then click “Add” and “Save”. And copy the ARN from AWS Console and past into Skill Function > Endpoint > Default Region. In this way they can interact and handshake together.

5

 

To test our sample Lambda Function code in the Console:

10

  • In the Function list, click the function name to open the details for the function and click the “select a test event > configure test events > Create new test event > Select one of the sample Alexa requests from the Event template, I choose “Alexa Start Session” > Enter the Event name > Create.

11

Then click the “Test” button. The Execution result should be succeeded.

12

This test was for testing the interaction. To test the skill itself, we open the skill at developer amazon console; there is a “Skill builder checklist” that I modified as needed;

1

“Invocation Name” is the name of the skill to begin interaction with a particular custom skill; for instance, if invocation name is: business library then user can say: hey Alexa, open / start {Skill Invocation Name}.

2

An “Intent” represents an action that fulfills a user’s spoken request. Intents can optionally have arguments called “Slots”. For example, in a Library Skill; defining librarians contact define an intent name “librarianContact” that has slots named name or contact.

There are two json files to modify/ import the custom function skill; one in developer console to “Json editor” that defines the interaction and one at AWS Console “index.js”.

Then Click “Build Model”.

3

Then Click “Test” menu, to test the custom skill;

  • In the text box in Alexa Simulator, type: Alexa, open {Invocation Name};

It will show the content we provided in the “WELCOME_MESSAGE” in the json file (index.js).6

 

Then we can ask or type more questions to interact with the simulator.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s