SCCapstone / CognitoFormsDev

MIT License
0 stars 0 forks source link

Constructing homecards #72

Closed tjcocklin closed 5 years ago

tjcocklin commented 5 years ago

A solution to implementing homecards has been found, which also removes the invocation phrase from the userInput. I have implemented it in the launch, and getNewFormIntent. Basically I just removed:

this.response.speak(speechOutput); this.emit(':responseReady');

and replaced it with:

this.emit(':askWithCard', speechOutput, repromptSpeech, cardTitle, cardContent, imageObj);

Look closely at how they are implemented in the code and replicate that for your assigned intent. Create a new branch named "(insert your intent name)cards", and replace all instances of :

this.response.speak(speechOutput); this.emit(':responseReady');

with a working version of:

this.emit(':askWithCard', speechOutput, repromptSpeech, cardTitle, cardContent, imageObj);

*note: this is not just copy and paste, it will take some experimenting with.

*note 2: The Alexa display options in the Amazon developer portal is glitchy and inconsistent when it comes to homecards. I would suggest downloading the Alexa app to your phone and using your phone as the test display. Meaning you would simply type your commands in the developer portal, and look at the results on your phone. Alternatively log into: alexa.amazon.com.

*note 3: instances of:

//this.response.speak(speechOutput); //this.emit(':responseReady');

should be ignored.

Here are some resources I used:

https://stackoverflow.com/questions/52645338/alexa-skill-developed-in-node-js-doesnt-display-any-card

https://developer.amazon.com/docs/custom-skills/include-a-card-in-your-skills-response.html#create-a-home-card-to-display-text-and-an-image

tjcocklin commented 5 years ago

cleaning up assignments

tjcocklin commented 5 years ago

home card construction completed close issue #72