alexa / alexa-cookbook Goto Github PK
View Code? Open in Web Editor NEWA series of sample code projects to be used for educational purposes during Alexa hackathons and workshops, and as a reference for tutorials and blog posts.
License: Other
A series of sample code projects to be used for educational purposes during Alexa hackathons and workshops, and as a reference for tutorials and blog posts.
License: Other
How can i get the complete user utterance ?
I'm following along with the Flashcard skill and enabled it as invited.
It appears in my echo skill list, but when I try and use it, it says: "I'm sorry, I'm having problems, please try later".
When I try and click on the skill in the list of skills, instead of showing details, it goes right back to the general list of all skills. Anyone else having this trouble?
I have a problem creating the IAM roles (whatever they are) (Lambda function section 9)
I click Roles after selecting IAM and I only have the options Create Role (and delete role), not Create New role as shown.
If I click Create Role, I get an entirely different screen - one that says Select type of trusted entity. I don't get Select Role Type, so can't select AWS Lambda
What do I do now?
hello,
I was hoping to have the PlanMyTrip intent be triggered immediately upon launch and I tried to get that to happen by modifying the LaunchRequest handler as follows:
'LaunchRequest': function () {
this.response.speak(welcomeOutput).listen(welcomeReprompt);
this.emit('PlanMyTrip');
},
Unfortunately, doing so immediately ends my session. I had tried even to move the body of the 'PlanMyTrip' handler into the 'LaunchRequest' handler to see if I'd get the expected behavior to no avail. Any help would be much appreciated.
I deployed the function to lambda, imported the voi and sucessfully connected them. However, when you test it the skill does not have the dialogue interaction that is "advertised". Try it.
"Open plan my trip"
Alexa: "Lets plan a trip. Where would you like to go?"
"I would like to go to Portland"
Alexa: "The fastest route to Portland is...."
It does not prompt you for were you are leaving from or when you want to go. As is suggested by both this tutorial and the videos with the interactive beta.
Deploying skill-events with ask is returning a 400 Bad Request exception with message "Error parsing the requested content. Please validate the enums in the request, which is a common cause for this exception."
If you just want a quick 'n' dirty test of TestFlow to check it does what you want/need, then try this (not all steps will be needed):
mkdir testing
cd testing
apt install svn
svn checkout https://github.com/alexa/alexa-cookbook/trunk/testing/TestFlow
cd TestFlow/src
npm install
cd ..
node testflow staterequest.txt
This probably isn't the correct repo to be posting this issue in; however, I couldn't find any repo for the ASK CLI in this organization, and there is no source code link on the ask-cli
NPM page, so I was at a loss. Anyway...
I was surprised to find that there is no official Docker image for development with the ASK CLI. The "amazon" user on Docker Hub contains only the these images for working specifically with ECS and Elastic Beanstalk, and there does not appear to be any official "alexa" user. Upon further investigation, I found the aws-codebuild-docker-images
repo in the "aws" GitHub organization, but unfortunately it does not have any sample Dockerfiles that install the ASK CLI either. I created a similar issue at the AWS CLI repo, because there is no official Amazon image for the AWS CLI either, so I imagine that whatever aws-cli
image gets (hopefully) created could serve as the base for an ask-cli
image.
TL; DR
I believe there should be an official ask-cli
Docker image maintained by Amazon and pushed to Docker Hub/Store. Ideally, it should support all the major modern Linux distros, including Alpine Linux. One should be able to run the following command, and have everything just work:
docker run -it alexa/ask-cli
Go to url: https://github.com/alexa/alexa-cookbook/tree/master/aws/Amazon-DynamoDB/read#grant-dynamodb-permissions-via-iam
Point 4 mentions:
For a quick demo, filter on "DynamoDB" and attach the AmazonDynamoDBReadOnlyAccess policy.
This didn't work for me.
I guess it should be: AmazonDynamoDBFullAccess
Alexa skill plan my trip giving error on text simulator
Can you add an example of a CreateListItem intent for the lists tutorial section? I can't seem to get the POST
right and keep getting message: null
responses whenever I try to add an item to a list, so an example would be much appreciated.
Thanks!
In addition to installing Twilio Node helper library, you will also need to install alexa-sdk to avoid missing module.
Line 18 in master/labs/HelloWorld/skill.json results in the error shown below when doing "ask deploy"
To fix this change line 18 FROM:
"category": "TRIVIA",
TO:
"category": "KNOWLEDGE_AND_TRIVIA",
ask deploy
-------------------- Create Skill Project --------------------
Profile for the deployment: [default]
\ Creating new skill...Call create-skill error.
Error code: 400
{
"message": "The skill manifest is not valid.",
"violations": [
{
"message": "Invalid category."
}
]
}
Lambda is completely different now. None of these instructions work anymore.
Following along with the instructions - so far so good until...
Not seeing what I think I should be seeing - screenshots below. Where am I going wrong?
Could someone please help me resolve a syntax error I'm getting when using the unaltered sample-nodejs-plan-my-trip src? I'm following the cookbook instructions
I get an "Execution result: failed" with following details when I press "save and test" my PlanMyTrip lambda function:
START RequestId: c89431d8-aeb8-11e7-a28a-13650abcedf2 Version: $LATEST
Syntax error in module 'index': SyntaxError
const speechOutput;
^^^^^^^^^^^^
SyntaxError: Missing initializer in const declaration
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
END RequestId: c89431d8-aeb8-11e7-a28a-13650abcedf2
REPORT RequestId: c89431d8-aeb8-11e7-a28a-13650abcedf2 Duration: 10.85 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 19 MB
Any advice on how to address this would be MUCH appreciated!
Thanks,
Hi,
please extend the sample HttpsGet with code telling the user that an API is going to be called and it may take a while. I'm wondering what's the best way to do.
Thank you,
Thomas
The SayArray function will say the first entry and the last two, i.e.
sayArray(['one', 'two', 'three', 'four', 'five'], 'and')
will return
'one, four and five'
When I try testing this as a Lambda function I get the error message:
"errorMessage": "No 'Unhandled' function defined for event: Unhandled"
No worries, so I add an "unhandled" event within the handlers object definition (see how I added some log statements - I'll get to this later...)
'Unhandled': function () {
console.log("unhandled: " + APP_ID);
console.log(this.event);
console.log("Slots:");
console.log(this.event.request.intent.slots);
var speechOutput = "Sorry, can you try again please";
this.emit(':tell', speechOutput);
}
It now compiles but Alexa will always defer to this handler for any reply. I have tested with voice on Alexa and in the test feature within the developer console.
What am I doing wrong? I have followed the steps in the video exactly. This is the request that is being generated (note that this has all the required slots included):
{
"session": {
"sessionId": "SessionId.baa326f5-de47-4184-a469-b7ddb7c64196",
"application": {
"applicationId": "amzn1.ask.skill.ccf431f1-51ec-4291-aeb4-d8e9b717a8fc"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AGLYUAQMBVXVHNB4V2KBYE5HX4EUWXFF4IHUVJKAOYOASBFXIIUQBSOD5OY2GWD5RRZEUXUWQ4XKSY6A2UWJRA2DPT2QLPRJYE4563F2C34DSSEHKX5XV47XLPW2NCRVF6QBFD63VDOU4WTBBTLZF2UQQ2DNLC67DMGUWLQXVSVFQEKFPCSCEYWDGOXSBKWUNH254IEAYAQHHIY"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.1e17fabf-a5a0-437a-be7e-8ef9d20ef2d2",
"locale": "en-GB",
"timestamp": "2017-04-28T02:04:17Z",
"intent": {
"name": "planMyTrip",
"slots": {
"activity": {
"name": "activity"
},
"travelDate": {
"name": "travelDate",
"value": "2017-W17-WE"
},
"toCity": {
"name": "toCity",
"value": "Portland"
},
"fromCity": {
"name": "fromCity",
"value": "la"
}
}
}
},
"version": "1.0"
}
And when I use this as a test in Lambda I get this response in the console. Notice how it seems to think that the App id is not set - seems a bit odd.
START RequestId: 4dffa344-2bba-11e7-aec1-4f06f1025efb Version: $LATEST
2017-04-28T02:28:04.038Z 4dffa344-2bba-11e7-aec1-4f06f1025efb Warning: Application ID is not set
2017-04-28T02:28:04.039Z 4dffa344-2bba-11e7-aec1-4f06f1025efb unhandled: amzn1.ask.skill.ccf431f1-51ec-4291-aeb4-d8e9b717a8fc
2017-04-28T02:28:04.039Z 4dffa344-2bba-11e7-aec1-4f06f1025efb { session:
{ sessionId: 'SessionId.baa326f5-de47-4184-a469-b7ddb7c64196',
application: { applicationId: 'amzn1.ask.skill.ccf431f1-51ec-4291-aeb4-d8e9b717a8fc' },
attributes: {},
user: { userId: 'amzn1.ask.account.AGLYUAQMBVXVHNB4V2KBYE5HX4EUWXFF4IHUVJKAOYOASBFXIIUQBSOD5OY2GWD5RRZEUXUWQ4XKSY6A2UWJRA2DPT2QLPRJYE4563F2C34DSSEHKX5XV47XLPW2NCRVF6QBFD63VDOU4WTBBTLZF2UQQ2DNLC67DMGUWLQXVSVFQEKFPCSCEYWDGOXSBKWUNH254IEAYAQHHIY' },
new: true },
request:
{ type: 'IntentRequest',
requestId: 'EdwRequestId.1e17fabf-a5a0-437a-be7e-8ef9d20ef2d2',
locale: 'en-GB',
timestamp: '2017-04-28T02:04:17Z',
intent: { name: 'planMyTrip', slots: [Object] } },
version: '1.0' }
2017-04-28T02:28:04.098Z 4dffa344-2bba-11e7-aec1-4f06f1025efb Slots:
2017-04-28T02:28:04.098Z 4dffa344-2bba-11e7-aec1-4f06f1025efb { activity: { name: 'activity' },
travelDate: { name: 'travelDate', value: '2017-W17-WE' },
toCity: { name: 'toCity', value: 'Portland' },
fromCity: { name: 'fromCity', value: 'la' } }
END RequestId: 4dffa344-2bba-11e7-aec1-4f06f1025efb
REPORT RequestId: 4dffa344-2bba-11e7-aec1-4f06f1025efb Duration: 118.02 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 28 MB
Any ideas what is going wrong?
at alexa-cookbook/handling-responses/dialog-directive-delegate/sample-nodejs-plan-my-trip/src/SampleWithoutTheSDK.js you work with a sample without the SDK but inline on line four says:
- This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
just so you people know and can get it updated
In step 7.1 of Delegate Dialog Directive Sample Project there is a link to ...alexa-cookbook/.../InteractionModel.json which is 404ing.
I am getting the below error:
"The remote endpoint could not be called, or the response it returned was invalid."
I have followed the below tutorial:
"https://github.com/alexa/alexa-cookbook/tree/master/aws/Amazon-S3/read"
I have followed all the steps
Hi, I'm new to Github so forgive me if this is obvious. In the instructions it says:
Instructions for deploying this sample skill
Complete Lab 8 within labs/HelloWorld to configure your AWS environment for persistent database storage.
Following the link, I can't see anything called Lab 8 and I'm not able to understand which step to take to enable the database referred to in 'Last Use' (which directs me to this page to enable the database).
Side comment: I've followed a few tutorials now and there often seems to be an incorrect link with an error page when we get to the point of needing the code.
Thanks,
designserve
Under section 8. of https://github.com/alexa/alexa-cookbook/blob/master/handling-responses/dialog-directive-delegate/step-by-step/2-lambda-function.md
Both links "provided code" and "GitHub" returns 404.
Could the whole step 8.2.1 to 8.2.4 be prebuilt? As this adds unnecessary complexity for this tutorial.
Thank you.
In case of Dialog state still not in complete state , this.emit is not causing execution to come to an end hence next lone gets executed with error
So execution is not getting stopped after this.emit statement in delegateSlotCollection
I had an utterance with just one slot value. No prefix or suffix, the utterance is just on slot value. It was working fine but now i am getting this error. “Sample intent utterances with phrase types cannot consist of only slots.” It was working fine before and it still works fine on another skill.
"errorMessage": "RequestId: 773dfb1b-56ff-11e8-b01c-8b1d348c3fd3 Process exited before completing request"
I also attach the Log Output:
START RequestId: 773dfb1b-56ff-11e8-b01c-8b1d348c3fd3 Version: $LATEST
2018-05-13T22:46:25.421Z 773dfb1b-56ff-11e8-b01c-8b1d348c3fd3 TypeError: Cannot read property 'locale' of undefined
at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:112:38)
at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js: 100:31)
at exports.handler (/var/task/index.js:19:11)
END RequestId: 773dfb1b-56ff-11e8-b01c-8b1d348c3fd3
REPORT RequestId: 773dfb1b-56ff-11e8-b01c-8b1d348c3fd3 Duration: 250.75 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 81 MB
RequestId: 773dfb1b-56ff-11e8-b01c-8b1d348c3fd3 Process exited before completing request
Please tell me how to solve this problem, I really appreciate it!
This works and looks up to date
https://github.com/alexa/alexa-cookbook/blob/master/testing/TestFlow/testflow.js
This doesn't work and is missing several debugging options
https://github.com/alexa/alexa-cookbook/blob/master/testing/TestFlow/src/testflow.js
Suggest removing the second copy in src as it might confuse someone, especially if they try and run it.
At the foot of https://github.com/alexa/alexa-cookbook/tree/master/aws/Amazon-DynamoDB/read#title it says to paste into DynamoDB.
I've checked all the perms, but I am getting a strange console error as described in this thread
https://forums.aws.amazon.com/thread.jspa?threadID=264318
The sample code says:
Click on the blue "Create Item" button
On the top left, click on the dropdown called "Tree" and change it to "Text"
Clear all text, then paste in the following JSON, then click "Save"
{ "id": "0", "message": "yes" }
Nothing happens when I click save, apart from Save greying out.
So I looked in the console, and this is the error that I get in both the latest Chrome and IE Edge (Win 10). Can anyone replicate this?
dynamodb-0.js:3971 Tue Sep 26 14:01:31 GMT+100 2017
SEVERE: Uncaught Client Exception:
com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'Zi' of undefined
at Unknown.Xgc(dynamodb-14.js)
at Unknown.aJc(dynamodb-14.js)
at Unknown._Rb(dynamodb-14.js)
at Unknown.fSb(dynamodb-14.js)
at Unknown.Qqb(dynamodb-14.js)
at Unknown.Zmb(dynamodb-14.js)
at Unknown.snb(dynamodb-14.js)
at Unknown.fDe(dynamodb-0.js)
at Unknown.Vn(dynamodb-0.js)
at Unknown.VTf(dynamodb-0.js)
at Unknown.MTf(dynamodb-0.js)
at Unknown.Gd(dynamodb-0.js)
at Unknown.Rd(dynamodb-0.js)
at Unknown.$Ce(dynamodb-0.js)
at Unknown.Id(dynamodb-0.js)
at Unknown.Ud(dynamodb-0.js)
at Unknown.pAh(dynamodb-0.js)
at Unknown.$Bh(dynamodb-0.js)
at Unknown.nGf(dynamodb-0.js)
at Unknown.qGf(dynamodb-0.js)
at Unknown.eval(dynamodb-0.js)
I am getting the following error on build:
When using a Dialog Model, sample utterances for intents cannot contain only slots
Any advice on how to determine what is causing this error?
Error building interaction model
When using a Dialog Model, sample utterances for intents cannot contain only slots
It's no longer possible to have sample utterances that are a slot only with no other text. I don't know why this constraint is in place (it's pretty annoying), but it makes this example skill fail to build.
Looking at this file https://github.com/alexa/alexa-cookbook/blob/59dd5fb75ffe1ce28bfb5f614672a8b41d1ca665/handling-responses/say-array/src/index.js how do you add a card with the response in addition to this.response.speak for Alexa speaking the response?
Deployed AWS alexa module using AWS lambda deploy.
my zip file contains. package.json package-lock.json node_modules index.js
When i tested my aws lambda function, it failed with Error below. I am using amazon alexa API.
function code call to voice output is: this.emit('some text');
2017-08-14T06:39:47.468Z 5af7ac74-80bb-11e7-9b7e-5b3b7c9fd513 TypeError: Cannot read property 'emit' of undefined at /var/task/index.js:62:31
Can you please provide request and response json sample for the cookbook for each step which would really help me to convert Node JS to Asp.Net WEB API.
current:
\handling-responses\dialog-directive-delegate\src
correct (based on link on step 8) :
/handling-responses/dialog-directive-delegate/sample-nodejs-plan-my-trip/src
missed one folder/directory
please update =D
Anyone having problems with intent routing?
I'm following this section from the cookbook, using latest Node ASK SDK v1.0.24:
It says:
// This will short-cut any incoming intent or launch requests and route them to this handler.
'NewSession': function() {
if (this.event.request.type === 'IntentRequest') {
this.emit(this.event.request.intent.name);
}
this.emit('LaunchRequest');
}
To route to the original intent, we emit the original intent via
this.event.request.name
Seems fair enough. So I tried it, and it's not working. I've console-logged everything, and it definitely is catching the intent. Here's my code:
'NewSession': function () {
console.log("In newsession function within menu");
if (this.event.request.type === 'IntentRequest') {
console.log("got an intentrequest within newsession in menu of " + this.event.request.intent.name);
console.log(this.attributes.STATE);
this.emit(this.event.request.intent.name);
}
this.handler.state = constants.states.MENU_MODE;
this.emit('MenuIntent');
},
And here's my log output:
got an intentrequest within newsession within menu: AMAZON.HelpIntent
In menuintent function within menu
So it definitely catches it, but doesn't reroute. But if I change newsession to launchrequest, it works!
Where am I going wrong?!
Sorry, I know this is probably totally basic but I've tried to add a yes/no continue to the skill.
Instead of just stopping after delivering skill, I want to add "Would you like another fact? yes or no"
Yes continues to give another and no ends the skill.
Is there a better place i should ask this?
Error comes up when an intent has multiple slots, and user only provides input for only some but not all of the slots.
Example:
BaseInput BASE_SPOKEN= baseNum= PRE_BASE_SPOKEN= preBase=2 POST_BASE_SPOKEN= postBase=
Is there a way to indicate "undefined" or "null" values in the dialog sequence file?
Many thanks,
TR
Hello, when I am trying to call the progressive response API from the existing lambda function, I am facing this issue.
2017-11-22T08:40:08.274Z bebcbe7b-cf60-11e7-be8e-ed18ddd1ba6c Unexpected exception 'TypeError: Cannot read property 'DirectiveService' of undefined':
TypeError: Cannot read property 'DirectiveService' of undefined
at Object.CardFaq (/var/task/index.js:66:38)
at emitNone (events.js:86:13)
at AlexaRequestEmitter.emit (events.js:185:7)
at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:215:10)
at AlexaRequestEmitter.ValidateRequest (/var/task/node_modules/alexa-sdk/lib/alexa.js:172:23)
at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:117:25)
at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:92:31)
at exports.handler (/var/task/index.js:12:19)
I understand how to make an API call using Node.js. My issue is how to change the hard-coded myRequest value based on a slot in my Alexa Skill, since I don't want to use an API in my skill for a single, hard-coded value. Is there code anywhere showing how to return API results based on a slot value that a user speaks?
Followed all steps fine but get the error below when doing ask deploy. Do not know what is causing the error. The skill get created in developer.amazon.com, but the lambda function does not get created in console.aws.amazon.com.
ask deploy
-------------------- Create Skill Project --------------------
Profile for the deployment: [default]
Skill Id: amzn1.ask.skill.68b7875d-XXXX-XXXX-XXXX-XXXXXXXXX
Skill deployment finished.
Call update-model error.
Error code: 400
{
"message": "The request is not valid.",
"violations": [
{
"message": "Error parsing the requested content. Please validate the input"
}
]
}
is there anything required in lambda setting
Currently, the readme is too succinct and PAGE2-4.MD is just normal instruction for building a general skill.
i can't seem to get it to work. i am testing with the response being just the image URL in the full screen bodytemplate6 by just modifying your code with a different template (also getting rid of most of the fact app stuff)
The error I get is the response is invalid? Expecting string,number,null,true,false got undefined
https://gist.github.com/yosun/1be49dad42b1d008e5207492096e612a
Urls are broken on line 39 of alexa-cookbook/handling-responses/dialog-directive-delegate/step-by-step/2-lambda-function.md
The display-directive example contains the following function:
function isSimulator() {
var isSimulator = !this.event.context; //simulator doesn't send context
return isSimulator;
}
However, when I go to test my skill in the Service Simulator, if I use the "Text" tab (default), the generated Service Request always contains context:
"context": {
"AudioPlayer": {
"playerActivity": "IDLE"
},
"System": {
"application": {
"applicationId": "<redacted>"
},
"user": {
"userId": "<redacted>"
},
"device": {
"supportedInterfaces": {}
}
}
},
If I use the "JSON" tab and either try to omit the context or add "Display": true
to supportedInterfaces
, I get an error saying my request is invalid.
As a result, I don't know how to test my Echo Show templates, since I already have non-Show-user beta testers on my app, so I have to check that the display directive is supported before rendering the template. All I'm getting in the Service Simulator are the default Echo Show templates generated from the Alexa app cards; I can't for the life of me figure out how to have it render the fancier templates.
Hello,
Thanks for all the samples,
Is there any chance to update Plan My Trip intent to ASK SDK V2?
Thanks!
Seems as though there's a mistake in the code for the tutorial for the new Skill Builder Beta.
In "alexa-cookbook/handling-responses/dialog-directive-delegate/src/index.js", the following is in the 'planMyTrip' function:
//activity is optional so we'll add it to the output
//only when we have a valid activity
var travelMode = isSlotValid(this.event.request, "travelMode");
if (travelMode) {
speechOutput += travelMode;
} else {
speechOutput += "You'll go ";
}
There is no mention of a 'travelMode' slot anywhere in the tutorial...
In "alexa-cookbook/handling-responses/dialog-directive-delegate/src/SampleWithoutTheSDK.js", the correct code is shown:
//activity is optional so we'll add it to the output
//only when we have a valid activity
var activity = isSlotValid(request, "activity");
if (activity) {
speechOutput += activity;
} else {
speechOutput += "You'll go ";
}
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.