I tried to create an Amazon echo skill that teaches scraped information in Java using the Alexa Skills Kit (ASK)

Introduction

I bought an Amazon Echo, so I used the time of the year-end and New Year holidays to try out skills. I'm used to Java, so I wrote it in Java to give it a quick try.

In order to learn the basics, I first made it while reading the Amazon document and looking at the information of those who have already posted. https://developer.amazon.com/ja/alexa-skills-kit

Anyway, I can see that it looks like this if you look at the sample source, so while looking at the document and source. https://github.com/amzn/alexa-skills-kit-java

The one I made is posted on github. https://github.com/ewai/amazon-echo-ask-sample

What kind of thing you made

Skills that tell you information about the site called Oisix (Maybe only the members can understand it ...) If you tell me, it will scrape and read out useful information from the site.

① Alexa! Open "Oisix"! ② Call out the function

It is a simple flow.

Calling a function Reacting keywords Processing content
Tell us about this week's feature! Special feature It scrapes the list of special pages of this week from the menu and reads it aloud.
Tell us about this week's sale items! Sale, discount It scrapes the sale page and reads out products with a 30% discount or more.
Tell us about this week's VIP products! VIP It reads out the products on the VIP page.

aws Lambda created

  1. Add trigger (Alexa skills kit)
  2. Function code to upload jar, set handler, etc.
  3. Add "ALEXA_APP_ID" in the environment variable. Set the Alexa skills application ID to value.
  4. Execution role setting
  5. Test it.

The first call seems to take more than 10 seconds. From the second time, it will react immediately. Over time, the startup will slow down again. It may be good if the skill is used very often, but it is not so, so it seems that some measures are necessary. Call it regularly.

If the design changes and the id or class changes, it needs to be repaired. ..

Alexa skills creation

  1. Skill information setting (Note that the application ID has been issued)
  2. Dialogue model creation
  3. Settings (lambda url required at this point)
  4. Test it. (Use the json parameter displayed here for testing on the Lambda side)
  5. Public information setting
  6. Privacy and compliance (only save. Do not apply for the time being)
  7. After setting all the above, "Skills Beta Testing" will be activated. Add your Amazon Echo account as a tester. Then it is ready for use, so give it a try.

If you make it a little more general and make a WEB maintenance screen, it seems that you can use it at any store. I don't understand the necessity and I can't put any effort into it.

Recommended Posts

I tried to create an Amazon echo skill that teaches scraped information in Java using the Alexa Skills Kit (ASK)
I tried to create Alexa skill in Java
I tried to create a Clova skill in Java
I tried using an extended for statement in Java
I tried to implement the Euclidean algorithm in Java
I tried using Dapr in Java to facilitate microservice development
After learning Progate, I tried to make an SNS application using Rails in the local environment
I tried to summarize the words that I often see in docker-compose.yml
I tried to display the calendar on the Eclipse console using Java.
I tried using JWT in Java
I tried to solve the past 10 questions that should be solved after registering with AtCoder in Java
[Introduction to Java] I tried to summarize the knowledge that I think is essential
I tried to make a talk application in Java using AI "A3RT"
[Ruby] I tried to summarize the methods that frequently appear in paiza
[Ruby] I tried to summarize the methods that frequently appear in paiza ②
I tried using Elasticsearch API in Java
I tried the new era in Java
I want to send an email in Java.
I tried to organize the session in Rails
I tried to implement deep learning in Java
I tried to output multiplication table in Java
I tried to develop an application in 2 languages
I tried using Wercker to create and publish a Docker image that launches GlassFish 5.
I tried to organize the cases used in programming
I tried using Google Cloud Vision API in Java
I tried to operate SQS using AWS Java SDK
# 2 [Note] I tried to calculate multiplication tables in Java.
I tried to make a login function in Java
~ I tried to learn functional programming in Java now ~
I tried to find out what changed in Java 9
I tried to build an environment using Docker (beginner)
I finished watching The Rose of Versailles, so I tried to reproduce the ending song in Java
I want to use Java Applet easily on the command line without using an IDE
[Java] I tried to make a rock-paper-scissors game that beginners can run on the console.
A story that I realized that I had to study as an engineer in the first place