Coder Social home page Coder Social logo

alexa-samples / skill-sample-nodejs-howto Goto Github PK

View Code? Open in Web Editor NEW
243.0 56.0 228.0 293 KB

This tutorial will walk first-time Alexa skills developers through all the required steps involved in creating a parameter-based skill using a template called ‘Minecraft Helper’. Ask how to craft an item, and this skill will give you instructions.

License: Apache License 2.0

JavaScript 61.65% PowerShell 22.99% Shell 15.36%

skill-sample-nodejs-howto's Introduction

Build An Alexa How-To Skill

This tutorial will walk first-time Alexa skills developers through all the required steps involved in creating a skill using a template called ‘Minecraft Helper’. Ask how to craft an item in the game Minecraft, and this skill will give you instructions.

Skill Architecture

Each skill consists of two basic parts, a front end and a back end. The front end is the voice interface, or VUI. The voice interface is configured through the voice interaction model. The back end is where the logic of your skill resides.

Three Options for Skill Setup

There are a number of different ways for you to setup your skill, depending on your experience and what tools you have available.


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

skill-sample-nodejs-howto's People

Contributors

akersh-s avatar aszk avatar deegles avatar franklin-lobb avatar jakemkelly avatar jeffblankenburg avatar jennjin avatar juanpescador avatar kunalhsatoz avatar letmypeoplecode avatar memodoring avatar paulcutsinger avatar raeglan avatar tonyamzn avatar xiangxie avatar ygzy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skill-sample-nodejs-howto's Issues

Test Step #4 Irrelevant content

Instructions reference Reindeer Trivia

"Test your skill with the Service Simulator. To validate that your skill is working as expected, use the Service Simulator. In the Enter Utterance text box, type "open reindeer trivia""

entity resolution resolves to utterance from a different state and intent

I'm creating a multiple choice skill where a user can answer a question by saying either the letter ('a', 'b', 'c') or the answer ('apple'). When a user returns to the skill, he/she can say 'continue' to resume playing.

The problem:
Ever since creating ContinueIntent, anytime a user answer 'b', or 'c' in STATE 2, ContinueIntent is called

Example:

STATE 1 ContinueIntent Utterances:
"resume",
"continue",
"I want to continue",
"I want to resume",
"I want to continue where I left off",
"continue where I left off"

STATE 2 AnswerIntent Utterances: **ContinueIntent is not in STATE 2
"{Answer}",
"let's go with {Answer}",
"I think the answer is {Answer}",
"I think it's {Answer}",
"how about {Answer}",
"is it {Answer}",
"i think {Answer}",
"the {Answer}",
"I want to go with {Answer}",
"I would think it's {Answer}",
"I want to say {Answer}",
"It's {Answer}",
"the answer {Answer}",
"{Answer} is the answer",
"the answer must be {Answer}",
....
....
....
(There are about 50 more utterances for this intent)

The only thing I can think of is that it is somehow resolving 'c' to 'continue' from ContinueIntent

Use slots with capital letters

As it stands, the slot values in recipes.js are all lower case. In my custom version of the skill, I've changed them all to capitalized and changed the corresponding values in the interaction model to be the same thing.

Yet, the skill will not function unless they're both completely lowercase. I plan on adding images to make better use of cards/devices with a screen but the titles aren't pleasantly formatted, since the recipes show up lowercase. How can I fix this?

Error in Testing step

I'm currently following the tutorial, and at the Testing step I'm getting an error

instructions/test-using-simulator.md

Skill I/O JSON output:

{
	"version": "1.0",
	"session": {
		"new": false,
		"sessionId": "amzn1.echo-api.session.2a5a0f93-10a5-4f40-b00b-218096cac7a9",
		"application": {
			"applicationId": "amzn1.ask.skill.e0b4a50f-e0cd-48b6-88a5-e7e76a7d57c7"
		},
		"user": {
			"userId": "amzn1.ask.account.AHFDBBWGOX7TIRLKOBPNUK4TLOQ7EUZXAGQV4EZODIVWQTOFYPAI3JSJCIIZLL4NZN6SELTB5Y7SG5KAZHGD4EK5J75PBLPZEBFBT5CIMFCLGYJHJ5VZYIU2YCY7YZLCM3FNPTL5M2S7Y7JAT5MMWAIUYR26KCCX2HOW3SOQASFXZEONF2GPAS6ERML2JHZMH5RJFZFY67VC2BI"
		}
	},
	"context": {
		"System": {
			"application": {
				"applicationId": "amzn1.ask.skill.e0b4a50f-e0cd-48b6-88a5-e7e76a7d57c7"
			},
			"user": {
				"userId": "amzn1.ask.account.AHFDBBWGOX7TIRLKOBPNUK4TLOQ7EUZXAGQV4EZODIVWQTOFYPAI3JSJCIIZLL4NZN6SELTB5Y7SG5KAZHGD4EK5J75PBLPZEBFBT5CIMFCLGYJHJ5VZYIU2YCY7YZLCM3FNPTL5M2S7Y7JAT5MMWAIUYR26KCCX2HOW3SOQASFXZEONF2GPAS6ERML2JHZMH5RJFZFY67VC2BI"
			},
			"device": {
				"deviceId": "amzn1.ask.device.AF3IRUD3GCKECKFXXQF2RDAXJB7X3CIK5HXCVUZWXY5IDJKFP7FFHVPTN5VGRH2LJUQ4NEUJ24LJKEQ5LHXBHPQ2ZSMFPD2WL33K5AUDK6MLHMEZ4TTYLQXW2BT3XHJFNEZPWCA56SP2JIXJ7Y3JWNTEHASWONQBYGHX4VXYAFJTWRUED4STO",
				"supportedInterfaces": {}
			},
			"apiEndpoint": "https://api.amazonalexa.com",
			"apiAccessToken": "ey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s2UuydE8YFajVel620Z0VegAMqER6R_E-8U3yYx_1tEGqRR0RSq6LVDty2y8Ex3EEgOnfJwld8pVfhqCj-AOcI_h3KR7wbz70uphj9NmXbChz6BBCSN_a88hOvCOAo-KX7etfbQeKxUn40i6a72JBvZgZUw-69CBLIsTsTb-StAiE2kPp1DhUIZGBc3uFGePQ9O0UeDqPQ"
		},
		"Viewport": {
			"experiences": [
				{
					"arcMinuteWidth": 246,
					"arcMinuteHeight": 144,
					"canRotate": false,
					"canResize": false
				}
			],
			"shape": "RECTANGLE",
			"pixelWidth": 1024,
			"pixelHeight": 600,
			"dpi": 160,
			"currentPixelWidth": 1024,
			"currentPixelHeight": 600,
			"touch": [
				"SINGLE"
			]
		}
	},
	"request": {
		"type": "SessionEndedRequest",
		"requestId": "amzn1.echo-api.request.d29ac71b-262c-44c2-b4c4-33d273cf95d4",
		"timestamp": "2019-03-09T22:53:09Z",
		"locale": "en-US",
		"reason": "ERROR",
		"error": {
			"type": "INVALID_RESPONSE",
			"message": "An exception occurred while dispatching the request to the skill."
		}
	}
}

I've copied & pasted code from the lambda/custom folder, so I'm not sure what's causing the error?

lambda function for howto returns error on invocation

When following the setup/install instructions as is, the lambda function created returns an error on invocation.

When I instead choose to use the Blueprint setup option with [alexa-skill-kit-sdk-howtoskill] as the blueprint template, the function works properly.

Minecraft skill returns cooking recipes for request

When following the instructions for the minecraft skill, the responses to all item invocations return cooking recipes. It looks like the intent/invocation side is not aligned with the lambda function code.

Card Title and Content out of wack

When testing the card response, the Title and Content are not returned correctly. I even ran this with the default app and configurations not changing anything and it is not returning the correct values for these.

thanks

Entity resolution

I have the original skill working, but am having trouble getting the newer entity resolution feature added using synonyms. It would be great if you could update the documentation to explain how to use this feature.

Way to close session after question answered

Hello!

Trying to end a session after a question is asked. Would the easiest way be to use the SessionEndedReuest?

Thank you!

        if (recipe) {
            this.attributes.speechOutput = recipe;
            this.attributes.repromptSpeech = this.t('RECIPE_REPEAT_MESSAGE');
            this.emit(':askWithCard', recipe, this.attributes.repromptSpeech, cardTitle, recipe);
            **this.emit('SessionEndedRequest');**
        }

SessionEndedRequest (from later in .js):

    'SessionEndedRequest': function () {
        this.emit(':tell', this.t('STOP_MESSAGE'));
    },

Recipe.js does not seem to be accessed

Two months ago the skill worked perfectly. Now when I test it, the skill will open and give the expected introduction but Alexa doesn't know any of the information that is in the recipe.js

Here is the testing output:
Testing output

{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.9972b07e-4016-4492-aa68-b80a98f547ce",
"application": {
"applicationId": "amzn1.ask.skill.aa3a79c1-f3ec-433c-a4a2-e41e6a325d5d"
},
"user": {
"userId": "amzn1.ask.account.AHF34PRT27A6IOM3UWG3KZE3SN5MEMPSJTV7JS2T3B6CJ2MHZMSOBQT2Y2PQKG5QMLBNLF2XN7FTKZP57ZVTHCMT35Y5P3LMQDUAUMK5XWVKHD2VESU4PWTKGDCXR33BMXTU57JTATREXYUIXJWLRQY3BLJR6KBKIIN6CXOQKZ77KMAQH3XVFDQBHIULNGOD4ZZNEAKJW6US73Q"
}
},
"context": {
"AudioPlayer": {
"playerActivity": "IDLE"
},
"Display": {
"token": ""
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.aa3a79c1-f3ec-433c-a4a2-e41e6a325d5d"
},
"user": {
"userId": "amzn1.ask.account.AHF34PRT27A6IOM3UWG3KZE3SN5MEMPSJTV7JS2T3B6CJ2MHZMSOBQT2Y2PQKG5QMLBNLF2XN7FTKZP57ZVTHCMT35Y5P3LMQDUAUMK5XWVKHD2VESU4PWTKGDCXR33BMXTU57JTATREXYUIXJWLRQY3BLJR6KBKIIN6CXOQKZ77KMAQH3XVFDQBHIULNGOD4ZZNEAKJW6US73Q"
},
"device": {
"deviceId": "amzn1.ask.device.AG3ZSIVG4ANTEP42N6Q2ILIOFIU5UY574PHISS57PSBC2WXZCHTXBRCG73AQLMK53MSV6G5DLTTP4EC2ICKQZX4LDKT4BIQYBHRY5PMJ6BP7ZOSSWVTTIXM635OKPHE4RNCFGOBWOKD6YVKW2GKDEYAZ6D2Q",
"supportedInterfaces": {
"AudioPlayer": {},
"Display": {
"templateVersion": "1.0",
"markupVersion": "1.0"
}
}
},
"apiEndpoint": "https://api.amazonalexa.com",
"apiAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.eyJhdWQiOiJodHRwczovL2FwaS5hbWF6b25hbGV4YS5jb20iLCJpc3MiOiJBbGV4YVNraWxsS2l0Iiwic3ViIjoiYW16bjEuYXNrLnNraWxsLmFhM2E3OWMxLWYzZWMtNDMzYy1hNGEyLWU0MWU2YTMyNWQ1ZCIsImV4cCI6MTUyNDgwNzYwOCwiaWF0IjoxNTI0ODA0MDA4LCJuYmYiOjE1MjQ4MDQwMDgsInByaXZhdGVDbGFpbXMiOnsiY29uc2VudFRva2VuIjpudWxsLCJkZXZpY2VJZCI6ImFtem4xLmFzay5kZXZpY2UuQUczWlNJVkc0QU5URVA0Mk42UTJJTElPRklVNVVZNTc0UEhJU1M1N1BTQkMyV1haQ0hUWEJSQ0c3M0FRTE1LNTNNU1Y2RzVETFRUUDRFQzJJQ0tRWlg0TERLVDRCSVFZQkhSWTVQTUo2QlA3Wk9TU1dWVFRJWE02MzVPS1BIRTRSTkNGR09CV09LRDZZVktXMkdLREVZQVo2RDJRIiwidXNlcklkIjoiYW16bjEuYXNrLmFjY291bnQuQUhGMzRQUlQyN0E2SU9NM1VXRzNLWkUzU041TUVNUFNKVFY3SlMyVDNCNkNKMk1IWk1TT0JRVDJZMlBRS0c1UU1MQk5MRjJYTjdGVEtaUDU3WlZUSENNVDM1WTVQM0xNUURVQVVNSzVYV1ZLSEQyVkVTVTRQV1RLR0RDWFIzM0JNWFRVNTdKVEFUUkVYWVVJWEpXTFJRWTNCTEpSNktCS0lJTjZDWE9RS1o3N0tNQVFIM1hWRkRRQkhJVUxOR09ENFpaTkVBS0pXNlVTNzNRIn19.Q9HAKaHUKV7mTzPIHiiyS-Bu3pdoFvhfVs9TlJCxxhKUNdbk-9feR9XfJ5Oda-rZO64kXo-FgRYXZpSwWdgbJXNvbWKeG2bUSPGPdcHAmRlb-Fhnqmli5KBvdl4D-3E9W9qvRH8_cEHRqDBvordKbxSBahXcqS91npsMRD7pzJoSFajZ6GrZsugNSD5AhTdjIyczmJ1NeOU_yMRwNprTrZ2AVQyCBpXesHasj5E9UaqIXh7c68X81budNatMfN4TraecM-iVcse8wg5OF9TfDmBr-tDeh4Wr9zFOfatrJSeZdY6k4vsdQsLjmgB2ngdogktH54YNgr3xHnPSZIqR7A"
}
},
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.0351aa00-4fc8-4338-a828-98b1a8dbea1c",
"timestamp": "2018-04-27T04:40:08Z",
"locale": "en-US",
"intent": {
"name": "RecipeIntent",
"confirmationStatus": "NONE",
"slots": {
"item": {
"name": "item",
"value": "kindness",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.aa3a79c1-f3ec-433c-a4a2-e41e6a325d5d.LIST_OF_ITEMS",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "kindness",
"id": "e9d6bfefbe0f6e457a00f031ad45d3c6"
}
}
]
}
]
},
"confirmationStatus": "NONE"
}
}
}
}
}

{
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "I'm sorry, I currently do not know that answer. What else can I help with?"
},
"reprompt": {
"outputSpeech": {
"type": "PlainText",
"text": "What else can I help with?"
}
},
"shouldEndSession": false
},
"sessionAttributes": {}
}
}

Cloud Watch

04:40:08
2018-04-27T04:40:08.584Z 10535bad-49d5-11e8-a0fb-07f13268905c session applicationId: amzn1.ask.skill.aa3a79c1-f3ec-433c-a4a2-e41e6a325d5d

04:40:08
2018-04-27T04:40:08.584Z 10535bad-49d5-11e8-a0fb-07f13268905c dispatch intent = RecipeIntent
2018-04-27T04:40:08.584Z 10535bad-49d5-11e8-a0fb-07f13268905c dispatch intent = RecipeIntent

Please explain as if talking to an 11-year old, coding newbie here :-)

Alexa Skills Kit video no longer working

I am trying to open the video link from this line, but it says "This presentation is no longer available."

Use JavaScript/Node.js and the Alexa Skills Kit to create a skill - You will use the template as a guide but the customization is up to you. For more background information on using the Alexa Skills Kit please watch this video.

Bad AWS nodejs instructions in documentation

In step #5 of "Setting up a Lambda Function," the documentation dealing with the downloaded code says:

On your local machine, go to the 'skill-sample-nodejs-howto/lambda/' directory and run 'deploy.js' using Node.
npm install aws-sdk
node deploy.js

An error is thrown because there is no 'deploy.js' file to be found.


jbj@MININT-MTSHK4F MINGW64 ~/Desktop/skill-sample-nodejs-howto-master/lambda
$ dir
custom node_modules

jbj@MININT-MTSHK4F MINGW64 ~/Desktop/skill-sample-nodejs-howto-master/lambda
$ dir custom
index.js package.json recipes.js

jbj@MININT-MTSHK4F MINGW64 ~/Desktop/skill-sample-nodejs-howto-master/lambda
$ node deploy.js
module.js:472
throw err;
^

Error: Cannot find module 'C:\Users\John\Desktop\skill-sample-nodejs-howto-maste
r\lambda\deploy.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3

jbj@MININT-MTSHK4F MINGW64 ~/Desktop/skill-sample-nodejs-howto-master/lambda

Your model used a depreciated format

Messages from ALEXA SKILLS KIT | SKILL BUILDER BETA on developer.amazon.com
Your interaction model did not validate. Check below for errors.
Your model used a depreciated format...

NODE.JS Changed

When the tutorial recommends using Node.js 4.3 in the Lambda console, the only option available is 6.10.

Wrong skill sample name?

I couldn't get this to work at first. It appears that the correct repo name for the lambda function is "skill-sample-nodejs-howto", not "alexa-skills-kit-nodejs-factskill" as noted on the Lambda instruction page...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.