alexa-samples / skill-sample-nodejs-fact Goto Github PK
View Code? Open in Web Editor NEWBuild An Alexa Fact Skill
License: Apache License 2.0
Build An Alexa Fact Skill
License: Apache License 2.0
You need to manually create the "alexa-cookbook.js" file. At least I did. And replace the contents of "package.json" from the git repo.
https://github.com/alexa/skill-sample-nodejs-fact/blob/en-US/instructions/2-lambda-function.md
Critical step linking to the code is returning 404 where it says "Copy and paste the provided code into the Lambda function code box.".
This page: https://github.com/alexa/skill-sample-nodejs-fact/blob/en-US/instructions/1-voice-user-interface.md
Has pretty important link that is broken - "Interaction Model" points to not-existing json file
https://github.com/alexa/skill-sample-nodejs-fact/blob/en-US/interactionModel.json
There is a file https://github.com/alexa/skill-sample-nodejs-fact/blob/en-US/models/en-US.json in repo
but it didnt work for me as model.
Also there is a typo here: https://github.com/alexa/skill-sample-nodejs-fact/blob/en-US/instructions/2-lambda-function.md
"You mays till have"
The click here link is broken in the space facts sample: https://github.com/alexa/skill-sample-nodejs-fact/blob/master/instructions/cli.md
redirects here: https://github.com/alexa/skill-sample-nodejs-fact/blob/master/instructions/1-voice-user-interface.md
404
the instructions referenced in 2-lambda-function.md for setting up your first lambda role https://github.com/alexa/skill-sample-nodejs-fact/blob/master/step-by-step/LAMBDAROLE.md is missing.
I followed the tutorial as is and tested it I am getting the correct response that is json object while testing in Alexa skill kit but when I try it on real device (echo) it keeps saying something went wrong.
The current hyperlink to the lambda role tutorial points to step-by-step/LAMBDAROLE.md
but the file is actually at the project root.
I can't seem to get the correct format for arn,
is there a place i can get my arn.
I am currently using:
arn:aws:lambda:us-east:#######:ask.skill:myappname
and I keep getting the error : The provided Lambda ARN is not in the correct format.
please help
Hi,
Hello.
I am in tokyo so my region in Alexa dev is Tokyo
I have followed the instruction to create a space fact skill.
I arrive at the lambda configuration step, I create the function, set the trigger.
(My region in Lambda is ap-northeast-1)
When I try to open the function code in the inline editor, the editor does not display anything. The icon is moving and moving.
I can not check nor the default code neither the code I want to publish.
Regards
Emmanuel
I've tried to use the sample code to build an alexa skill in Hindi but every time I pass a valid user input I'm not getting any proper output. I'm using alexa hosted back-end.
Example:
Me: ( A valid user invoke statement )
Alexa: "< Audio Only Response >"
I am very new at developing with alexa. I followed to tutorial but when I get into the testing section it gives me an error:
The remote endpoint could not be called, or the response it returned was invalid.
Don't know what I did wrong - the arn is copied correctly.
I'm following the tutorial here: https://developer.amazon.com/alexa-skills-kit/tutorials/fact-skill-4
Mentions listening to this skill in action by adding skill "Gloucester Facts", which isn't on the marketplace when searched, also a dead link from the ReadMe.
The interface has some changes/additions, mostly due to the new Echo Show I think.
lambda-role.md
uses a number of images that have been removed. Either new screenshots need to be added or the old ones restored.
It looks like that all the TODOs in the index.js
have been removed with this commit: fd7307a
This breaks Part 5 of the tutorial.
The documentation on amazon developer site only mentions "." "," "?" as characters that influence the speech. Does exclamation mark actually change alexa's voice? I can't hear a difference.
Hi
I'm an Alexa- beginner and I do not understand the behavior of this skill:
(testing with https://developer.amazon.com/alexa/console/)
Alexa, open Space Facts
Here's your fact: Neutron stars can spin at a rate of 600 rotations per second
afterward:
Alexa, start Space Facts to help
The first person to reach space and the first person to be in orbit was Yuri Gagarin.
again:
open Space Facts
Here's your fact: The largest asteroid ever recorded is a mammoth piece of space rock named Ceres.
help
For Help, please visit the help pages on the Amazon web site.
it seems to me that after GetNewFactIntent
, the skill immediately "exit"
and I have to invoke again the skill.
So I do not understand when events will be fired:
'AMAZON.HelpIntent': function () {
const speechOutput = HELP_MESSAGE;
const reprompt = HELP_REPROMPT;
this.response.speak(speechOutput).listen(reprompt);
this.emit(':responseReady');
},
'AMAZON.CancelIntent': function () {
this.response.speak(STOP_MESSAGE);
this.emit(':responseReady');
},
'AMAZON.StopIntent': function () {
this.response.speak(STOP_MESSAGE);
this.emit(':responseReady');
Any idea?
BTW, In general, how can I "maintain" the session open into the skill, avoiding to exit after the first intent?
Thanks
giorgio
I'm new to Alexa skills, I fallowed all the steps. Here's the error I get on this line "var Alexa = require("alexa-sdk");". Am I doing something wrong? Or is there some configuration setting I need to do?
{
"errorMessage": "Cannot find module 'alexa-sdk'",
What I am missing so far from the basic skill examples in NodeJS is the use of an API.
alexa / skill-sample-nodejs-hello-world
alexa / skill-sample-nodejs-fact
alexa / skill-sample-nodejs-first-skill
alexa / skill-sample-nodejs-trivia
alexa / skill-sample-nodejs-quiz-game
How do you call an external service and process the response, especially with async/await.
Or did I just didn't see it when looking through the source?
Hi! I followed this tutorial and submitted a skill to Amazon. I forgot about and came back two months later to see it had a fair amount of use, but the 1 review posted said that it opened but that subsequent commands didn't work. I checked the metrics, and that appears to be the case for everyone who downloaded it.
I didn't have any issues in the simulator, but when I tested it on echoism.io I had the same issue. Here's the code I'm using compared to the source code, and some screenshots. What am I doing incorrectly? My app is called "Good Questions" fyi.
Here's the index code comparison.
Here's the json file. It looks a little different, but when I submitted it to Amazon it was the same and it appears that the code was deprecated and the skill builder updated it automatically.
Here's a screenshot of my skill builder -
Let me know if you need anything else - thanks in advance!
On forking this to AWS lambda, and testing in developer console it gives:
[SOLVED]
I would like to port Alexa skill samples to other programming languages
Is there a guide provided by amzn?
I have configured everything up to the Test stage. I invoke it with open space geek
and it just spins there and does nothing. Is this a known issue?
I copied and pasted the code then tested, but it doesn't work.
{
"errorMessage": "Cannot find module './question'",
"errorType": "Error",
"stackTrace": [
"Function.Module._load (module.js:417:25)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)",
"Object. (/var/task/index.js:16:19)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)"
]
}
when I call this function in ASK, it doesn't retrun anything.
Anyone here can help me?
The link destination of "Alexa ユーザーとシステムユーザーを関連付ける" has a 404 error.
The current link is on top, but correctly is probably not the one below.
[current]
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/linking-an-alexa-user-with-a-user-in-your-system
[correct?]
https://developer.amazon.com/ja/docs/custom-skills/link-an-alexa-user-with-a-user-in-your-system.html
I am on mac and for some reason this happens when i try on Lambda to test the function
{
"errorMessage": "Cannot find module '/var/task/index'",
"errorType": "Error",
"stackTrace": [
"require (internal/module.js:12:17)"
]
}
Hi, I am modifying the code to include repeat intent. I need to maintain the session attributes to get the repeat working. If you know how to maintain the session, please let me know. Thanks.
FYI -- The following is the code I added for repeatIntent:
'AMAZON.RepeatIntent': function () { var reprompt = this.t("HELP_MESSAGE"); console.log('Inside RepeatIntent Stored speech attributes: ' + this.attributes['speech']); this.emit(':ask', this.attributes['speech'], reprompt); },
Hey, after changing the directory where all my files are I get the following error:
[Error]: Failed to deploy. Please ensure current working directory is the root of your skill project.
AWS CLI is properly configured. Do you have a guess of what could be happening?
Thanks for your time
Hello,
The sample app does not seem to handle the phrases "Exit/close/quit" even though these are required for certification. Whats more, even if you do add these to the sample utterances
and test out on developer.amazon.com, it does not seem to work at all:
AMAZON.StopIntent exit
AMAZON.StopIntent close
AMAZON.StopIntent quit
Also, just testing this on Lambda, with a Alexa End session
with edited App ID fails with the message:
{
"errorMessage": "No 'Unhandled' function defined for event: Unhandled",
"errorType": "Error",
"stackTrace": [
"AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:140:15)",
"AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:110:23)",
"AlexaRequestEmitter.Object.defineProperty.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:72:31)",
"exports.handler (/var/task/index.js:34:11)"
]
}
EDIT: Similar to : https://forums.developer.amazon.com/questions/5938/error-with-utterances-quit-exit-remote-endpoint.html
EDIT2: The sample app does handle stop
but apparently this is not sufficient for certification
What could the issue be?
@PaulCutsinger
@deegles
There's no description of creating such a zip file. It appears that this is telling me to pull the repo and create a ZIP file with a portion of the source files, but this is really confusing, especially for an intro level tutorial. The tutorial should have clear instructions on how to get this file.
I am new at developing with alexa. I followed to tutorial but when I get into the testing section it gives me an error:
The remote endpoint could not be called, or the response it returned was invalid.
Don't know what I did wrong - the arn is copied correctly.
I'm following the tutorial here: https://developer.amazon.com/alexa-skills-kit/tutorials/fact-skill-4
I am facing the issue in both N Virginia and Ireland regions
Hey franklin
Is this line required? it also will throw an error when copied to a lambda SAR
const cookbook = require('alexa-cookbook.js');
After i call "open space facts". It's give me a fact, but if after i say "tell me a fact", it's not working, "Sorry, I don't know that". But if i put .reprompt(speakOutput) after line 27 in index.js, it's start working well.
In order to acquire more "skills" on development of Alexa Skills I would like to modify this code and go in a different path. I would like to:
1.) call the skill "Alexa, open space curiosities.. "
2.) Alexa responds "For Which planet are you looking for facts ?"
3.) I will respond for example "Saturn"
4.) Then alexa goes to the fact "website database" and respond with a fact BUT just for the chosed planet.
Somebody has ideas on how to start ?
I guess first I need to work with the slots and then with the index.js file don´t ?
Looking at the folder skill-sample-nodejs-fact/models/, there is no sample interaction model for the French locale.
In particular, what sample utterances would you recommend using in French for "tell me a fact"?
I'm following the tutorial (https://developer.amazon.com/public/community/post/Tx3DVGG0K0TPUGQ/New-Alexa-Skills-Kit-Template:-Step-by-Step-Guide-to-Build-a-Fact-Skill) and getting "t.t0.message.includes in a not a function" when trying to create the lambda action (after uploading the zip). Just posting this in case anyone knows the resolution and for future reference.
I'm very new to making skills for Alexa, so trying to follow along but I'm stuck. Seems like I'm having a problem while testing using the skill code that's provided in this tutorial. When I test the sample code in the Lambda function code box, I get an error that states that the unhandled function is undefined. This seems to be a problem with a few folks, so I found the following code that helped to solve the error that I inserted in the handlers section:
'Unhandled': function () {
this.emit(':ask', HELP_MESSAGE, HELP_REPROMPT);
}
The error disappears, but outside of testing out launch, help, & stop/cancel intents, I am not able to get the correct responses to the my intents when I enter my utterances. The only response I can get to the utterances for the GetNewFactIntent is whatever is in the unhandled function (i.e, HELP_MESSAGE).
Hope this makes sense. Can anyone help???
This Alexa skill sample documentation needs updating to reflect to changes made in the developer console.
If you would like help more developers you should UPDATE your documentation as this makes this current sample guide for development using its tools near impossible!!!!
If you did put this repository to help others great! if not remove it we don't need to feed your star ego!
Hi,
Can you upload a sample code to read firestore(Google's firebase storage) data??
Where can i find the Lambda's ARN (Amazon Resource Name)
https://github.com/alexa/skill-sample-nodejs-fact/blob/ja-JP/instructions/2-lambda-function.md
「Lambda関数のコード入力ボックスに必要なコードを貼り付けます。このスキル用のコードは GitHubにあります。コード入力ボックス内のコードを削除し、この新しいコードを貼り付けてください。」
のGitHubがリンク切れしています。更新していただけますか。
Hi,
I applied for certification after following the skill-sample guide and got below response from Amazon.
"Future versions of the Alexa Skills Kit may add new properties to the JSON request and response formats, while maintaining backward compatibility for the existing properties. When we invoke the skill with additional parameters, the skill is rejecting it when we expect this to be accepted. Your code must be resilient to these types of changes. For example, your code for de-serializing a JSON request must not break when it encounters a new, unknown property."
However, i tried and added multiple extra elements in the request and the response always returned 200.
Below is my lambda function:
'use strict';
var Alexa = require('alexa-sdk');
var APP_ID = "amzn1.ask.skill.f472dac6-e6ca-48bb-9dfb-4d34c009b975";
var SKILL_NAME = "Cricket Facts";
var GET_FACT_MESSAGE = "Here's your fact: ";
var HELP_MESSAGE = "You can say tell me a cricket fact, or, you can say exit... What can I help you with?";
var HELP_REPROMPT = "What can I help you with?";
var STOP_MESSAGE = "Goodbye!";
var data = [
"It is said that cricket originated in England. Since they used to raise sheep, the grass was so short that it was possible to roll a lump of wool on it which they used as a ball.",
"The first recorded game was played in 1646, and later fines were handed out for those who missed the church to play.",
"In the 1760’s, pitching a ball through the air was considered normal, thus the bat shape changed from a curve to a straight one.",
"The longest cricket match took place in 1939 between England and South Africa, after 14 days it ended with a tie.",
"The two most common causes for pausing or suspending a cricket game is rain and bad light.",
"When a batsman scores 100 runs, it called a century and is considered an achievement.",
"A cricket game was once stopped because a pig ran across the field. It is even considered legal to suspend the game if an animal entered the field.",
"Only one player can run out at a time. Usually left for the umpire to decide.",
"A cricket game has two umpires in the field and one off the field.",
"Despite being a team game, individuals are stressed upon and put under pressure.",
"Shahid Afridi used Sachin Tendulkar's bat to hit the fastest ever ODI century.",
"Chris Gayle is the only batsman to hit a six off the first ball of a Test match",
"Abbas Ali Baig was the first Indian cricketer to be kissed during a Test",
"Vinod Kambli's Test match average is better than his childhood friend Sachin Tendulkar",
"Sunil Gavaskar was out off the first ball of a Test match thrice in his career",
"ML Jaisimha and Ravi Shastri are the only Indians to bat on all five days of a Test",
"The only cricketer to play Test cricket for India and England is Saif Ali Khan’s grandfather, Iftikhar Ali Khan Pataudi",
"Lala Amarnath is the only bowler to dismiss Don Bradman hit wicket in Test cricket",
"There's an uncanny similarity between the Indo-Pak match at the Australasia Cup of 1986 and Asia Cup 2014",
"India won the 1983 World Cup and won their first ever Test at Lord’s three years later in 1986.",
"India won their second World Cup 28 years later in 2011 and remarkably won their second ever Test at Lord’s three years later in 2014.",
"India is the only country to win the 60-Over, 50-Over and 20-Over World Cup",
"Alec Stewart was born on 8-4-63 and he scored 8463 Test runs",
"Asif Karim of Kenya has played International cricket and Davis Cup (Tennis) for his country",
"Wilfred Rhodes of England played Test cricket till he was 52!",
"Allan Border played 153 consecutive Test matches",
"The only Indian Test cricketer to be knighted is Maharaja of Vizianagaram",
"Australia beat England by 45 runs in the first ever cricket Test as well as the Centenary Test in 1977",
"All four innings of a test on the same day",
"There's only one person who witnessed Jim Laker and Anil Kumble taking 10 wickets in an innings",
"On the morning of 11/11/11 South Africa needed 111 runs to win at 11:11",
"Peter Siddle is the only bowler to take a hat-trick on his birthday",
"India's Mohinder Amarnath is the only cricketer to be dismissed for handling the ball and obstructing the field",
"West Indies' Leslie Hylton is the only cricketer to be hanged for murder",
"Two Robin Singhs have played Test cricket for India and both never got to play after their debut Test",
"Sachin Tendulkar played for Pakistan before India"
];
//=========================================================================================================================================
//Editing anything below this line might break your skill.
//=========================================================================================================================================
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
'LaunchRequest': function () {
this.emit('GetNewFactIntent');
},
'GetNewCricketFact': function () {
var factArr = data;
var factIndex = Math.floor(Math.random() * factArr.length);
var randomFact = factArr[factIndex];
var speechOutput = GET_FACT_MESSAGE + randomFact;
this.emit(':tellWithCard', speechOutput, SKILL_NAME, randomFact)
},
'AMAZON.HelpIntent': function () {
var speechOutput = HELP_MESSAGE;
var reprompt = HELP_REPROMPT;
this.emit(':ask', speechOutput, reprompt);
},
'AMAZON.CancelIntent': function () {
this.emit(':tell', STOP_MESSAGE);
},
'AMAZON.StopIntent': function () {
this.emit(':tell', STOP_MESSAGE);
}
};
Any help to understand what validation is failing? Sample request is below:
{
"session": {
"sessionId": "SessionId.8cf178d5-5687-4b6a-b8f8-dc422e186c2d",
"junkParam": "junkValue",
"application": {
"applicationId": "amzn1.ask.skill.f472dac6-e6ca-48bb-9dfb-4d34c009b975",
"junkParam": "junkValue"
},
"attributes": {
"junkParam": "junkValue"
},
"user": {
"userId": "amzn1.ask.account.AHEBAL5FTGHIGN67OVCPN3Z6YNVBSLA624DION4IYK7URUFGC3NNVI5ZGACWUBEO2FRJWJTR7S5YM62VZT4HM2R3LPQPDV666GCIIAM7ZJJBMO2ZCJSOCTJ4TMKHNRGA5S2TDY2BSSRM4DOQRLFW63LLLER72HV5YJ4IS3QIRALAMLWSKNER566S2JLFV43YRDEXZXOIH3TC6VQ",
"junkParam": "junkValue"
},
"new": true
},
"request": {
"type": "IntentRequest",
"junkParam": "junkValue",
"requestId": "EdwRequestId.d9bb38de-aa58-4981-a32b-e1d32701d1f9",
"locale": "en-US",
"timestamp": "2017-06-06T02:15:01Z",
"intent": {
"name": "GetNewCricketFact",
"junkParam": "junkValue",
"slots": {}
}
},
"version": "1.0"
}
Regards,
Navin
When you test and utter the sample utterance, the skill wont launch. It only launches when invocation name is called. The Python space facts also do the same.
I used this code to make a fact skill but it immediately ends the session after giving the fact. Just saying "Alexa, open ___ facts" gives the fact and then is done. How can I get the session to stay open? I cannot figure it out. I have tried adding more intents. I've tried adding to the code. I'm definitely a newbie but I can usually figure things out but this is driving me nuts. I just want the skill to let me go through more than 1 fact. Ideally, the user could ask for facts over and over again and then just say stop or stop using it then it closes. Is this too advanced of a program for a beginner to try?
Hi,
the tutorial does not work completlty. If I try to enable the skill I get the error:
Call enable-skill error.
Error code: 403
{
"message": "Skill is not ready for enablement.",
"violations": [
{
"message": "custom - object has missing required properties (["endpoint"])"
}
]
}
So I guess that some configuration is missing?
After entering the utterance "Tell me a fact", I am getting error as "The remote endpoint could not be called, or the response it returned was invalid." I tried the troubleshooting step, and it was fine, but in logs I found some Application ID issue. (Please check the attachment).
Can you please help me on this?
The link on Step 11 at 2-lambda-function for securing the lambda function gives a 404 error.
The Runtime needs to be changed for the AWS Lambda Template
Runtime: nodejs8.10 is not supported any longer
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.