Skip to content

Instantly share code, notes, and snippets.

@gnakan
Last active February 21, 2020 21:25
Show Gist options
  • Save gnakan/92e3d0c72cd74c653f31d68fe52e51d9 to your computer and use it in GitHub Desktop.
Save gnakan/92e3d0c72cd74c653f31d68fe52e51d9 to your computer and use it in GitHub Desktop.
Tutorial on creating a basic percent calculator Alexa skill

The Basics

An Alexa skill has two basic pieces:

  1. A skill services
  2. A skill interface

The skill service is where the logic is held. For our calculator, the skill service is responsible for handling events, running the computations and returning the answer. For this tutorial, we will create our skill service using Node.JS and AWS Lambda.

Why Node.JS? The short answer: I've been working with it on a few other project lately. I was actually torn between using Node.JS or Python.

The skill interface translates what a user says into events, which are then sent to the skill service for processing. For this tutorial, we will be using the Alexa Skill Builder tool, currently in beta.

Utterances Intent

Building It

Part 1: Skill Service Configuration

  1. Sign in to the Amazon Developer Portal
  2. Select "Alexa" from the top menu bar.
  3. Under "Alexa Skills Kit", click the "Get Started" button
  4. Click the "Add New Skill" button
  5. Enter skill information then click the "Save" button Create Alexa Skill screenshot
  6. After it saves, click the "Next" button.
  7. We are going to build the interaction model using the Skill BuilderClick the "Launch Skill Builder Beta" button. More information about the Skill Builder service (in Beta at the time of this writing) is available here. When prompted, choose "Discard". Launch Skill Builder Beta button screenshot
  8. Add a new intent. Our first intent will be a greeting. This intent will be triggered when a user says "Alexa, open percent calculator".
  9. Save your model.

Part 2: Create Lambda Function

  1. Sign in to AWS at https://aws.amazon.com/.
  2. Choose "Lambda"
  3. Select the "Alexa Fact" blueprint. This makes it easier to get setup since there are some external libraries needed.
  4. Choose "Alexa Skills Kit" as a trigger. This will take care of permissions.
  5. Enter code
  6. Role: Create custom role
  7. At the role pop-up screen, click the "Allow" button
  8. Choose "Next" then click "Create function" button
  9. Copy the Amazon Resource Name (ARN) displayed in the upper-right corner of the console that starts with arn:aws:lambda....

Part 3. Update Skill

  1. Alexa Skills Portal > Configuration: Update your endpoint

Links

@reidbackstrom
Copy link

reidbackstrom commented Dec 2, 2017

New to developing on Alexa (or anything for that matter) - is there sample code for the calculator? The directive of "enter code" is throwing me off as I'm not sure what to do with it.

@coolpic783
Copy link

any way of doing it on the self-hosted skills?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment