Learn
Often, you want to combine session attribute values with another string to generate a custom speech output.
Let’s consider our movie genre skill. If we wanted Alexa to respond with the current genre of a movie, which has been stored in a session attribute, we could use the following to generate the speech output.
'SetGenreIntent': function() { this.attributes['genre'] = this.event.request.intent.slots.genres.value; this.response.speak('Ok, so you like ' + this.attributes['genre'] + ' movies.' + 'Let me ask you a few more questions and ' + 'then I’ll give you my recommendation.').listen(); this.emit(':responseReady'); }
We can see the interpolation in the this.response.speak
speech output, where we insert the genre
session attribute inside of the response.
Instructions
1.
In the SetMyLanguageIntent
speech output, replace the hard-coded instance of “Ruby” with the language
session attribute, making sure to use interpolation where needed.
2.
Do the same in the AskQuestion
function at the bottom of index.js.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.