Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Developing Alexa Skills With Spring Boot REST Services in Mind

DZone's Guide to

Developing Alexa Skills With Spring Boot REST Services in Mind

This straightforward article outlines the steps to consider to bring your REST applications to Alexa skills.

· IoT Zone ·
Free Resource

In this article, I’m going to explain Amazon Alexa integration with your REST application service.

Technology used:

1. Java 1.8

2. Spring Boot 2

3. Alexa Skill Kit SDK – Java

4. Amazon development account (free for one year).

What Will This Application Do With Alexa?

It’s a simple application; it will provide you the information about your policy expiration date. A user has to provide their policy date and date of birth, and Alexa will respond back.

Example:

Scenario 1: Positive Scenario

User: Alexa, Open RedX Insurance.

Alexa: Welcome to RedX Insurance. Do you want to check your policy expiry date?

User: Yes.

Alexa: Please tell me your policy number.

User: A111.

Alexa: Thank you. Please tell me your date of birth.

User: 15 December 2017

Alexa: Policy going to expire on 16-Nov-2018. Thank you.

Scenario 2: Negative Scenario

User: Alexa, open RedX Insurance.

Alexa: Welcome to RedC Insurance. Do you want to check your policy expiry date?

User: Yes.

Alexa: Please tell me your policy number.

User: A111.

Alexa: Thank you. Please tell me your date of birth.

User: 15 December 2017.

Alexa: Sorry, policy not available. Thank you.

Configuration Alexa REST Client and Microservice Sample

Step 1

Download this source from the repository/import it directly into your IDE.

Step 2

Configure a Spring microservice application in your IDE.

File -> Import->Existing Maven Project

Spring 1

Step 3

Configure the Alexa REST Client application in the IDE.

File -> import->Existing Maven Project

Image title

Step 4

We're using a MySQL database, so run this db.sql script.

Alexa REST Client Code Configuration Process

Step 1

Here is the reference application.

Step 2

Get my sample file from my GitHub, and you will see the sample application.

Step 3

Import the Alexa application in Eclipse.

Step 4

Set up the welcome message in the Alexa application:

Image title

AWS Free Account Creation Steps

Step 1

Click here and create a free account.

Image title

Step 2

Pass valid information and click continue.

Image title

Step 3

We're going to use a Professional account type. AWS free accounts are available for the USA region, so please set your country as USA.

ContactUS

Step 4

Click Create Account and continue.

Step 5

You'll need to pass credit card information. They won’t bill you for this step. After one year, they will ask you to select a plan. So, for one year, you can use this account and develop your Alexa projects.

Image title

Step 6

Log into the developer console:

Image title


Step 7

Start an Alexa skill:

Image title

Step 8

Create the skill:

Image title


Step 9

Create a new skill and name it RedXAlexaINsurance:

Image title

Step 10

Select Custom Model to add to your skill:

Image title

Step 11

Invocation name creation:

Image title


Step 12

Create an Intent: policy number.

First, I create the Welcome Info Intent model:

Image title

Image title

Step 13

Then I created my Date of Birth Info Intent.

The Intent slot type is Amazone.Date:

Image title

Source Code : https://github.com/shrisowdhaman/alexa_applicaton/

Topics:
alexa ,alexa app development ,alexa skills developer ,spring

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}