question

James L Guinn avatar image
James L Guinn asked

How to test Alexa Skills Color Example end-to-end with Lambda Test button?

I can build the colors test and run it on my Echo device. It also tests ok from within the Lambda function using the sample event template: "Alexa Intent - MyColorIs" to invoke a new session welcoming me to color test with help. I can alter that template to send a "WhatsMyColorIntent" to return: "SessionSpeechlet - I'm not sure what your favorite color is, you can say, my favorite color is red" How would I combine a test call to declare my favorite color and then return said favorite color? Thanks, Jim
alexa skills kitdebugging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Greg Laabs avatar image
Greg Laabs answered
You can't do that as a single request because it's not a single request. The Intent to declaring your favorite color should return some sessionAttributes to the Echo. Then when you ask for your favorite color, those same attributes will be send in the request. So if you want to test that second intent, the one where it uses what you delcared and tells you what it is, you'll need to include said attributes in your request. But long term, you should be doing all of your testing before you ever get it up on Lambda, using some sort of testing framework like Mocha. It will save you a ton of grief.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

James L Guinn avatar image
James L Guinn answered
Thank you for your reply. Makes sense and not a surprise. I see that I need to send attributes but now having trouble forming them. I know this is a newbie question but any help with example attribute clause for, say, color=purple? I've tried quite a few guesses and cannot find any actual examples of how to do this. Which leads me to another question... Any simple supported way to view actual JSON text of what Alexa sends to Lambda? Thanks again.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Nick Gardner avatar image
Nick Gardner answered
At least when using the default Lambda functions, I don't believe there's any options to get the raw json input, but you can put some in there yourself when testing. -Nick
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.