mr-smithers-excellent / alexa-skill-java

Alexa Skill using Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hello World using an Alexa Skill and Java

Pre-setup Alexa Skill

  1. Create an account at http://developer.amazon.com and login

  2. Select Alexa, Alexa Skills Kit, Get Started >, Add a New Skill

  3. Use Name and Invocation Name as Hello World

  4. Click on Save

  5. Copy the Application Id and paste it in the HelloWorldSpeechletRequestStreamHandler class

Create Lambda function

  1. Create bucket: aws s3 mb s3://arungupta --region us-east-1.

  2. Create and upload a deployment package: mvn -f hello-alexa-world/pom.xml package install

  3. Create Lambda function:

    aws lambda create-function \
    --function-name HelloWorld \
    --runtime java8 \
    --memory-size 1024 \
    --timeout 30 \
    --region us-east-1 \
    --role arn:aws:iam::091144949931:role/lambda_basic_execution \
    --handler org.sample.aws.alexa.hello.HelloWorldSpeechletRequestStreamHandler \
    --zip-file fileb://./hello-alexa-world/target/hello-alexa-world-1.0-SNAPSHOT.jar \
    --publish
  4. Set up Alexa Skills Kit as a trigger for the Lambda function in the Console

Setup Alexa Skill

  1. In developer.amazon.com tab, click on Next

  2. Copy content of IntentSchema.json in Intent Schema

  3. Copy content of SampleUtterances.txt in Sample Utterances

  4. Click on Next

    1. Select AWS Lambda ARN, North America

    2. Get Function ARN: aws lambda get-function --function-name HelloWorld --region us-east-1 | jq .Configuration.FunctionArn

  5. Paste the ARN

  6. Click on Next

Test Alexa Skill

In Service Simulator, type hello in Enter Utterance and click on Ask Hello World. The output should look as shown.

alexa skill simulator

Skill can also be tested at https://echosim.io/ or using Alexa Echo.

References

About

Alexa Skill using Java

License:Apache License 2.0


Languages

Language:Java 100.0%