This node.js example connector makes a Teneo bot available on Amazon Alexa as a Skill. This guide will take you through the steps of deploying the connector to respond to events sent by Alexa.
You can find the source code of this project on Github.
Create an Amazon Developer Account here.
Your bot needs to be published and you need to know the engine URL.
Go to the Amazon Developer Console and create a new skill:
Create Skill
Create Skill
at the upper right of pageClick Interaction Model in left menu then select the JSON Editor
section, paste the JSON below.
In the example JSON below we will call our bot 'Studio bot'. If you want to use a different name to invoke your bot, make sure you update the invocationName
and the sample sentences for the AMAZON.StopIntent
. You can do this after you have pasted the JSON below into the Amazon JSON Editor.
{
"interactionModel": {
"languageModel": {
"invocationName": "studio bot",
"intents": [
{
"name": "AMAZON.FallbackIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": [
"close studio bot",
"dismiss studio bot",
"shut down studio bot",
"goodbye studio bot",
"bye studio bot"
]
},
{
"name": "teneointent",
"slots": [
{
"name": "RawInput",
"type": "LIST_OF_COMMANDS"
}
],
"samples": [
"{RawInput}"
]
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
}
],
"types": [
{
"name": "LIST_OF_COMMANDS",
"values": [
{
"name": {
"value": "Hello"
}
},
{
"name": {
"value": "What is your name"
}
},
{
"name": {
"value": "Where are you"
}
}
]
}
]
}
}
}
This JSON represents the Interaction Model of this Alexa skill, and defines:
Click Save Model
and then Build Model
at the top of the page to build and update Alexa's Interaction model. This will take about a minute.
Before continuing setting up things on Alexa's Developer Console side, get the connector code running using one of the two available ways described ahead:
The first way is by running the connector on Heroku. This is the easiest to get the connector running for non-developers since it does not require you to run node.js or download or modify any code.
The second way is to run the connector locally or to deploy it on a server of your choice. This preferred if you're familiar with node.js development and want to have a closer look at the code and plan to enhance or modify it.
Click the button below to deploy the connector to Heroku:
In the 'Config Vars' section, add the following:
When deployment completes, click 'View' to visualize the URL of the newly created app in a new browser tab. This tab will not work by itself, so just copy its URL and we will use it as a Service Endpoint URL
in the next steps ahead.
If you want to run the connector locally, follow the steps below. If you have already followed the instructions above to deploy the connector on Heroku, you can skip this section and continuing setup on Alexa Developer Console.
git clone https://github.com/artificialsolutions/tie-api-example-alexa.git
npm install
.env
file in the folder where you stored the source, and add the Teneo engine url:
TENEO_ENGINE_URL=<your_engine_url>
node server.js
Next, we need to make the connector available via https. We'll use ngrok for this.
ngrok http 3467
Service Endpoint URL
in the next steps ahead.Endpoint
from the left menu.HTTPS
service endpoint type, and paste the public URL from ngrok obtained earlier in the Default Region
field. Make sure this URL does not end in a slash character '/'.Select SSL certificate type
dropdown, select My developement endpoint is a sub-domain ... that has a wildcard certificate from a certificate authority
.That's it! You're now ready to talk to your Alexa bot.
The following input parameters are included in requests to Engine.
In addition to the input entered by the user, requests to the Teneo Engine also contain an input paramter 'channel' with value 'amazon-alexa'. This allows you to change the behavior of your bot, depending on the channel used. For information on how to retrieve the value of an input parameter in Teneo Studio, see Store input parameters on the Teneo Developers website.
Was this page helpful?