Connecting Amazon Alexa to JAICF project
Alexa Skill — is an app that the user can activate using the voice and then can interact with Amazon Echo devices. For more details on Alexa Skills, see the official Amazon website.
To connect the Amazon Alexa channel to the JAICF project, please follow these steps:
Prepare the project
Before connecting the channel, prepare the JAICF project in advance:
- Specify the following in the dependencies of
build.gradle.kts
file:
dependencies {
// ...
implementation("com.just-ai.jaicf:jaicp:$jaicfVersion")
implementation("com.just-ai.jaicf:alexa:$jaicfVersion")
}
$jaicfVersion
with the latest framework version.- Configure depending on the connection method to the platform:
-
long polling
— the bot will connect to the Just AI server when interacting with the platform. Simple solution, convenient for local development and debugging.For this method, specify the channel
AlexaChannel
in theJaicpPoller.kt
file:
package com.just-ai.jaicf.template.connections
fun main() {
JaicpPollingConnector(
templateBot,
accessToken,
channels = listOf(
ChatApiChannel,
ChatWidgetChannel,
TelephonyChannel,
AlexaChannel
)
).runBlocking()
}
-
webhook
— the bot will receive messages from the platform using the specified link. Must be configured to connect JAICP Cloud.For this method, specify the channel
AlexaChannel
in theJaicpServer.kt
file:
package com.just-ai.jaicf.template.connections
fun main() {
JaicpServer(
botApi = templateBot,
accessToken = accessToken,
channels = listOf(
ChatApiChannel,
ChatWidgetChannel,
TelephonyChannel,
AlexaChannel
)
).start(wait = true)
}
Create a channel
Open the JAICF project on JAICP. Go to the Channels tab on the side panel, then click Inbound → Connect channel. In the Voice Assistants section, choose Alexa. Specify the channel name and click Create.
Click Get webhook under the name of the newly created channel. It will be copied to the clipboard. The copied webhook will be needed later when configuring the skill.
Register a skill
Create a new skill
Sign in to the Alexa Developer Console. To create the skill in the developer console, click Create skill, and specify the following parameters:
- Skill name — skill name for the catalog.
- Default language — the default language to use. You can add additional languages support after creating the skill.
- Choose Custom as an interaction model, and Provision your own as a location.
Click Create skill. Select Start from scratch to create a new blank skill.
Configure the skill
Click Invocation on the left panel. Choose the invocation name in the field Skill Invocation Name. It will be used to launch a skill.
Then click Endpoint on the left panel. Choose HTTPS as a Service Endpoint Type, and then fill in the fields:
Default Region
— fill in the webhook that was copied to the clipboard when creating the channel.- Choose My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority as an SSL certificate.
Click Save Endpoints.
Click Build on the upper panel → then click Build Model.
Test the skill
To test the skill, click Test on the upper panel, choose Development in the field Skill testing is enabled in. You can also use the Echo device for testing.
Publish the skill
While you are testing a skill, it is only available to you. To make it available to other users, you need to do the following:
- Go to the Distribution tab.
- Submit skill data and submit it for moderation to Amazon.
After the skill is moderated, it will become available to all users.