Skip to content

mrahman4/AlexaSamTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build An Alexa Alexa-Nodejs-Dynamic-Content Skill

This Alexa template enable developer to easily implement a dynamic content Skill. And event after publishing the Skill he can still modify and maintain the skill content without need to change in Alexa model or Lambda code. This skill depend on data saved in DynamoDB table. You can configure every thing inside the database. voice tone, images that will appear in Alexa cards, Alexa reply in case user need help, order of conversation, different content every session,... etc
Each time user lunch the skill, skill will pick a different story from database and Lambda code will control dialogue with user using the story parts.

To Get Started click the button below:

Get Started

Or click here for instructions using the ASK CLI (command line interface). Kindly note that The ASK CLI (command line interface) cannot complete this task below and provides only partial completion. Therefore it is better to follow the instructions below, by pressing the ** Getting Started **.

How to fill the Database

1- StoriesTable

Field Type Mandatory Description Example
pkStoryID Number Yes Represent the a unique story number. When Alexa skill start it pick a random story. 2
firstPartID Number Yes Point to this story first story in parts table 40

2- StoryPartsTable Each story part can be a question that user need to answer to move the next part, or user should select between 2 choices and based on his selection the next parts will be different

Field Type Mandatory Description Example
pkStoryID Number Yes Represent the story number. 2
skPartID Number Yes Represent the a unique part ID. 40
lastPart Number 0 or 1 Yes 1 means last part in this story. Alexa will end the conversation. 0 means, user input is expected. 0
partType Number 1 or 2 Yes 1 means Choice part so based on user choice sequance of parts will differ. 2 means Question part. 1
speechOutput String Yes Alexa will say this text. You can use SSML. Today is first day in school after summer vacation.
repromptSpeech String Yes Text without SSML tags first day
cardTitle String Optional Title of the Card Guess the Country Name
cardContent String Optional Card Content Country of Eiffel Tower
largeImageUrl String Optional Card large Image. Ensure to follow Alexa requirements in image https://....
smallImageUrl String Optional Card small Image. Ensure to follow Alexa requirements in image https://....
option1PartID Number Yes if part type = 1 In case user select this option. This will be the ID that Alexa will move to it next 4
option1Type Number Yes if part type = 1 This equivalents to categories Alexa will support whatever it is default such as list of countries or custom list of values. Value will be determined based on Configuration.js file inside Lambda and Developer implementation 4
option1Answer String Yes if part type = 1 Alexa will match user input with this value to detect if user want this option or the 2nd option Country Name
option2PartID Number Yes if part type = 1 In case user select this option. This will be the ID that Alexa will move to it next 4
option2Type Number Yes if part type = 1 This equivalents to categories Alexa will support whatever it is default such as list of countries or custom list of values. Value will be determined based on Configuration.js file inside Lambda and Developer implementation 4
option2Answer String Yes if part type = 1 Alexa will match user input with this value to detect if user want this option or the 1st option Country Name
targetAnswerNextPart Number Yes if part type = 2 if user ansewer the question correctly, Alexa will move to part with this ID 4
targetAnswerType Number Yes if part type = 2 This equivalents to categories Alexa will support whatever it is default such as list of countries or custom list of values. Value will be determined based on Configuration.js file inside Lambda and Developer implementation 4
targetAnswer String Yes if part type = 2 Alexa will match user input with this value to detect if user correctly answer the question or not France
hintSpeechOutput String Yes Alexa will say this text when user give wrong answer to help him. You can't use SSML here. As a hint, it is Capital is Paris. You can Google it if you don’t know. What is the Country Name?
hintRepromptSpeech String Yes Alexa will say this text when user give wrong answer to help him As a hint, it is Capital is Paris. You can Google it if you don’t know. What is the Country Name?
hintCardTitle String Optional Title of the hint Card Guess the Country Name
hintCardContent String Optional Hint card Content Country Capital is Paris
hintLargeImageUrl String Optional Hint card large Image. Ensure to follow Alexa requirements in image https://....
hintSmallImageUrl String Optional Hint card small Image. Ensure to follow Alexa requirements in image https://....

Lambda configuration

1- Configuration.js : This file contains all lookup such: part type values, last type value, supported intent types. You can add or modify as you want 2- app.js : don't forget to check TODO comments.

Example

This template is used to build "Play with Mariam" skill which is certified and live. Skill targeting children and its purpose is to teach them new things by engage them in different challenges. Every time child use the skill he will find a different random story, in each story he will be asked different questions and child have to answer those questions to move to next question. And Skill give help to child if he answer wrongly.

StoriesTable for this skill as the below

pkStoryID firstPartID name target
1 1 Grandfather buzzles Mathematics challenges.
2 20 Countries and Flags Information about different countries.
3 40 In the Zoo Information about animals.

As the above table, this skill has 3 stories. Every time user use this skill one of those stories will be selected randomly. There is 2 mandatory fields: pkStoryID & firstPartID. Other fields are not used by engine of skill. As you can see story with ID = 2, will check table StoryPartsTable to find part which has ID = 40.

pkStoryID 2
skPartID 20
lastPart 0 This part is not the last part in story #2
partType 1 Alexa will give user 2 options, and he should choose one of them
speechOutput Today is first day in school after summer vacation. Mariam is very excited to return back to her friends, teachers and lectures. In her first class, miss Sarah said, Good morning my little heroes, today we will play a small nice game. Game name is Around the world. I’ll choose random students; each student will tell us about a country that he had visited during last summer vacation without telling us the name of the country. Rest of us should guess the country name. Winner will be the one who will correctly answer more questions. Tell me first, do you want to guess the Country name or Country flag color?. This what Alexa will say. You can use Alexa SSML language. User can choose either country or flag
repromptSpeech Today is first day in school after summer vacation. Mariam is very excited to return back to her friends, teachers and lectures. In her first class, miss Sarah said, Good morning my little heroes, today we will play a small nice game. Game name is Around the world. I’ll choose random students; each student will tell us about a country that he had visited during last summer vacation without telling us the name of the country. Rest of us should guess the country name. Winner will be the one who will correctly answer more questions. Tell me first, do you want to guess the Country name or Country flag color?.
cardTitle Name or Flag The title of the card in mobile app
cardContent Country Name or Flag Color ? The content of the card in mobile app
largeImageUrl https://..... URL for the large image that will be displayed in the Card. Check Alexa requirements in picture sizes and format
smallImageUrl https://..... URL for the large image that will be displayed in the Card. Check Alexa requirements in picture sizes and format
option1PartID 22 if user select this option, next part will be the part has ID = 22
option1Type 4 '4' means that we expect user answer to be a string. check Configuration.js to customize values based on your need
option1Answer Country Name if user want to select first option he need to say 'Country Name'
option2PartID 42 if user select this option, next part will be the part has ID = 42
option2Type 4 '4' means that we expect user answer to be a string. check Configuration.js to customize values based on your need
option2Answer Flag Color if user want to select 2nd option he need to say 'Flag Color'
targetAnswerNextPart 0 Not used in this part type
targetAnswerType 0 Not used in this part type
targetAnswer 0 Not used in this part type
hintSpeechOutput Choose Game you like, Say either Country Name or Say Flag Color
hintRepromptSpeech Choose Game you like, Say either Country Name or Say Flag Color
hintCardTitle Name or Flag
hintCardContent Say Country Name or Say Flag Color
hintLargeImageUrl optional
hintSmallImageUrl optional
First part in this story will ask user choose either the country name or flag color, and based on user choice dialogue will move forward.

Additional Resources

Community

Tutorials & Guides

  • Voice Design Guide - A great resource for learning conversational and voice user interface design.
  • Codecademy: Learn Alexa - Learn how to build an Alexa Skill from within your browser with this beginner friendly tutorial on Codecademy!

Documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published