• Stars
    star
    228
  • Rank 175,267 (Top 4 %)
  • Language
    JavaScript
  • Created over 8 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Alexa "hello, world" template

Build your First Alexa Skill

Alexa Skill Terminology

Each Alexa skill is comprised of an “Invocation Name” which you can think of as your app name, a set of “Intents” and the phrases that map to each intent, and the software that can detect the intent and return an appropriate result.

Hello World Skill

The skill we’re going to build is going to be an adaptation of the classic “Hello, World!” program.

Skill Steps

Building your first skill will comprise of four steps. First we’re going to copy the “Hello, World!” code into Amazon Lambda, which will be responsible for running the code. Next we’re going to set up our skill in the Amazon Alexa Skills Developer Portal, and link our lambda account to that skill. Then we’re going to test using the Amazon service simulator and on an Alexa-enabled device. Lastly, we’ll walk through the steps of customizing your skill to your needs.

Alexa Skill Links

I put together a list of resources at https://bit.ly/alexaskill, which is a public Instapaper folder I set up to make sharing the list of links easy. The slides will refer to each of these links. I’d recommend having this open in a tab so you can refer back to the links easily.

Step 1

Step 1: Lambda

Step 1a: AWS Login

  • Open the AWS Lambda console
  • Login or create an account with the same Amazon account that your Alexa device is linked to.

Step 1b: Amazon Lambda Function

Enter the name of your Lambda function. It’s not very important what the name is but it needs to be unique, you can just use “HelloWorld”. In the top right it should say “N. Virginia”. If that’s not the case please select “US-East (N. Virginia)” from the dropdown.

Step 1c: Copy Source Code

Copy the Hello World application source code

Step 1d: Paste Source Code

Back in Lambda, you’re going to scroll down a bit and paste the code you copied from GitHub into the large text box under “Lambda function code”.

Step 1e: Set Execution Role

Scroll down a bit further to the “Lambda function handler and role” section. You’re going to want to set the role to “lambda_basic_execution”. It’s important to note that if this is your first time using Lambda, you’ll have to create the “lambda_basic_execution” role. You can do that by selecting the first option “* Basic Execution” and clicking the blue button on the next page. After you take that step, you should be able to select “lambda_basic_execution”.

Step 1d: Finish Creating Lambda Function

Once you’ve created the function, click on the “Event Sources” tab, then click the blue “Add event source” link, then select “Alexa Skills Kit” from the modal dropdown.

Please note if you’ve never signed up for the Amazon Developer Portal, you’ll have to do that first before the “Alexa Skills Kit” will appear from the Event Sources dropdown. Please also make sure you use the same Amazon account as the one you’re using for AWS and your Echo.

Step 1 Done

Step 1 Done

Keep the Amazon Lambda tab open though, we’ll need to come back to it!

Step 2

Step 2: Amazon Skills Portal

Step 2a: Amazon Developer Login

Open the Amazon Developer Skills portal and login with the same Amazon account that your Alexa device is linked with.

Step 2b: Navigate to Add New Skill

Click the yellow “Get Started >” button under “Alexa Skills Kit”, then the yellow “Add a New Skill” button on the next page.

Step 2c: Name and Invocation Name

The name of your Amazon Alexa skill must be unique for your account, and the invocation name is what you’ll use to activate the skill. “Alexa, tell to say Hello, World”. You can use “Hello World” if you’re lacking in creativity. Click the yellow “Next” button when you’re ready!

Step 2d: Interaction Model

Here is where we’re going to tell the skill which intents we support, and what type of words will trigger each intent. Get ready for some copy and pasting.

Step 2e: Copy Intent Schema

Open the Hello World intent schema and copy all of the text in the box.

Step 2f: Paste Intent Schema

Back in the Amazon Skills portal, paste the intent schema you copied into the Intent Schema field.

Step 2g: Copy Sample Utterances

Open the Hello World sample utterances and copy all of the text in the box.

Step 2h: Paste Sample Utterances

Back in the Amazon Skills portal, paste the sample utterances you copied into the Sample Utterances field. Click the yellow “Next” button after you’ve pasted the Sample Utterances.

Step 2i: Configuration

Change the radio button from “HTTPS” to “Lambda ARN” and select the “No” radio button under Account Linking. Now we’ll have to go and grab the Lambda Amazon Resource Name (ARN) from our Lambda tab. You still have that open, right?

Step 2j: Copy ARN

The ARN is on the top right of the Lambda function page. I have it selected in the image above. You’ll want to copy the selection as I have it above.

Step 2k: Paste ARN

Paste the ARN into the text field, and press “Next”.

Step 2 Done

Step 2 Done

Step 3

Step 3: Amazon Skill Test

Step 3a: Service Simulator

After you click “Next” on the “Configuration” tab, you should be on the “Test” tab. Under the “Service Simulator” portion you’ll be able to enter a sample utterance to trigger your skill. For the “Hello, World” example you should type “say hello world”, and on the right you should see the output from the Lambda function you created: “Hello, World!”

Step 3b: Test on Device

If you got the correct output using the Service Simulator, try it on the Amazon Echo. We were using “last name” as the invocation name in this presentation, but you should use the invocation name you set in step 2c.

Alexa, tell Hello World to say Hello World

Step 3 Done

Step 3 Done

Congrats, you just created your first Alexa skill! đź‘Źđź‘Ź

Step 4: Customize

Step 4: Customize

Step 4a: Change Sample Utterances

Go back to “Interaction Model” tab in the Alexa Skill Developer portal, and edit the words on the right of “TestIntent” with the words you would like to say to Alexa. An example might be “who is the coolest person on earth”, and you’d say “Alexa, ask who is the coolest person on earth?” Next we’ll customize the output.

Step 4b: Change Lambda Output

  • Go to the "Code" tab in Lambda.
  • Scroll to line 104 and replace Hello, World with your output.
  • Keep the quotes around your output.
  • Click "Save".
  • Test in Amazon Developer Portal.

Step 4 Done

Step 4 Done

More Repositories

1

testflight_invite

Script to add users to TestFlight in iTunes Connect programmatically
Python
148
star
2

CustomKeyboard

A custom iOS QWERTY keyboard written in Swift.
Swift
94
star
3

medium-to-jekyll

Convert Medium exported posts to Jekyll posts
Python
43
star
4

karmabot

All your ++ and --
CoffeeScript
42
star
5

calendar-sync

Sync your personal and work Gmail calendars using IFTTT and Amazon Lambda.
Python
18
star
6

ethTip

Ethereum tip module for websites
JavaScript
11
star
7

anonbot

Anonymous messages in Slack
Python
10
star
8

itc_analytics

iTunes Analytics CSV Exporter
Python
9
star
9

eo-nytimes

Update Electric Objects with NYTimes frontpage.
Python
8
star
10

Recents

Your contacts sorted reverse chronologically, that's it.
Objective-C
7
star
11

boogle

A http://byte.co search engine (seriously)
Python
5
star
12

nonsmoker

Alexa skill that tells me how long it's been since I quit smoking, and how much money I've saved since I quit smoking.
Python
5
star
13

Shamebot

SHAME! SHAME! SHAME!
Python
3
star
14

ethFollowing

Ethereum transactions and wallet information for people you follow on Twitter.
Python
2
star
15

deadlink

Chrome extension that detects 404s, checks if page exists on archive.org, and gives you the option to view it on archive.org
JavaScript
2
star
16

donohue.github.io

CSS
2
star
17

offlinebot

"Someone thinks you should take this discussion offline."
Python
2
star
18

twttr

Barebones Twitter client made for CodeGenius iOS9 demos
Objective-C
2
star
19

GlassmapRelayTechnology

Proof of concept for Glassmap's battery saving relay technology
Objective-C
2
star
20

wherebrianatswift

Swift iOS app that tracks my location and posts it to a server
Objective-C
1
star
21

wherebrianat

iOS app that tracks my location and posts it to a server
Objective-C
1
star
22

betaworks_conference_rooms

Alexa Skill that lets the user know which conference rooms are available either now or at the time they specify.
Python
1
star
23

loremipsumwtf

http://loremipsum.wtf
HTML
1
star
24

vm.applescript

Launch five terminal tabs and SSH into a host on each tab.
AppleScript
1
star