Alexa Setup

This tutorial is used to show how to setup an Amazon's Alexa command service from scratch.

Step 1: Create accounts

  1. Create an Amazon Developer account on https://developer.amazon.com/alexa/console/ask
  2. Create an Amazon AWS account on https://aws.amazon.com/

Step 2: Setup on Amazon Developer

  1. On the top right of the whole page of Amazon Developer (Alexa), click "Your Alexa Consoles" -> "skills".
  2. Click "Create Skill" button.
  3. Type in a skill name and choose "Custom".
  4. Click "Create skill" button on the top right corner.
  5. Choose "start from scratch"
  6. On the left, choose "JSON Editor".
  7. Download a .json file. Then, drag and drop it to the page.
  8. Click "Save Model" and "Build Model" on the top.

Step 3: Setup on AWS

  1. Go to Amazon AWS and signin.
  2. Select "Lambda". (make sure the resion is "N. Virginia" on the top right corner.
  3. Click "create function" from scratch.
  4. Type in a name and choose "Java 8" as runtime. (You may want to choose create from template instead you don't need to choose an template)
  5. Under "Add triggers", select "Alexa Skills Kit". You will see there is a tag name "Configure triggers" at the bottom of this page. We need a "Skill ID" (this is the unique ID of the alexa skill we created just now, please refer to the following steps).

Step 4: Setup IDs

  1. Go to Amazon Developer and choose the Alexa Skill you created just now.
  2. On the left side, choose "Endpoint".
  3. Choose "AWS Lambda ARN" and you will see "Your Skill ID". Then, click "Copy to Clipboard" to copy the ID.
  4. Back to Amazon AWS "Configure triggers" we mentioned in the Step 3 and paste the ID to "Skill ID". Click "Add" button at the bottom.
  5. Click the "Lambda test" icon in the middle, it shows a tag named "Function code".
  6. Download the .zip file and unzip it. Then, upload the /target/xxx.jar-with-dependencies.jar to "Function code" section.
  7. Change "Handler" to "TipStreamHandler"
  8. Click "Save" button on the top right corner.
  9. Copy and paste "ARN" code on the top right corner of this page back to Alexa Skill page on Amazon Developer ("AWS Lambda ARN" -> "Default Region") and click "Save Endpoints" button.
  10. On Alexa Skill page, select "Test" on the top of the page. Switch "Skill testing is enabled in" to "Development", and then type "no butts" in the textarea. You will see and hear the following sentences:
    "Congratulations on taking the first step towards quitting smoking. We know that quitting smoking is hard, and that it can take many tries before you quit for good. It's important to never give up. No Butts can help you with quit smoking tips, how to deal with cravings, and come up with a personal plan to quit smoking. And more. To start, you can say, quit smoking tip, or, help with a craving."

Now, you have alread set up an Alexa command service. If your alexa device is bind to the same account, then it automatically get enabled on it. (You can download an Amazon Alexa app on your IOS/android devices and test it).

For editing, you can take a look at
https://alexa-skills-kit-sdk-for-java.readthedocs.io/en/latest/Developing-Your-First-Skill.html.

One tip for editing, if generating the jar produce a "Mojoexception", just right click on the project and select rebuild project. Other than that, email me for other questions