Closed guilhermelirio closed 2 years ago
Hey @guilhermelirio
Thank you for the feature request. As a workaround you could use hooks:
// app.ts
app.hook('after.platform.init', (error: JovoError, host: Host, jovo: Jovo, next: Function) => {
alexaSkill.$type = {
type: 'ON_SESSION_RESUMED',
};
});
app.setHandler({
ON_SESSION_RESUMED() {
}
});
Don't work:
app.hook('after.platform.init', (error, host, jovo) => {
jovo.$alexaSkill.$type = {
type: 'ON_SESSION_RESUMED',
};
});
app.setHandler({
ON_SESSION_RESUMED() {
console.log('teste')
},
LAUNCH() {
return this.showSimpleCard('Teste Hook', strings.intro).ask(strings.intro);
},
})
It goes through console.log('test') and stops there.
In this case it won't route to LAUNCH
after ON_SESSION_RESUMED
This will return the card and ask response.
app.setHandler({
ON_SESSION_RESUMED() {
return this.showSimpleCard('Teste Hook', strings.intro).ask(strings.intro);
},
})
Hi @aswetlow , thanks for the help.
So that way, on all intent calls, it executes ON_SESSION_RESUMED.
In my case, I would need it to work the same as Alexa Shopping, but I believe this is not possible.
Yes, you have to make the check in the hook:
app.hook('after.platform.init', (error, host, jovo) => {
if(jovo.$reqeust.request.type === 'XXXXX') {
jovo.$alexaSkill.$type = {
type: 'ON_SESSION_RESUMED',
};
}
});
Thanks @aswetlow , it`s work!
I'm submitting a...
Expected Behavior
https://developer.amazon.com/en-US/docs/alexa/alexa-shopping/implement-shopping-actions.html
Alexa Shopping allows you to create skills where you can add products from an official store to your cart.
It uses the add Directive function (which already exists in the Jovo), but it needs a special intent type: SessionResumedRequest At the link above, there are examples.