Skip to content

Instantly share code, notes, and snippets.

View kinisoftware's full-sized avatar

Joaquin Engelmo Moriche kinisoftware

View GitHub Profile
{
"type": "Pager",
"id": "moviesPager",
"width": "100vw",
"height": "70vh",
"item": [
{
"type": "moviesListLayout",
"title": "${data.title}",
"releaseDate": "${data.releaseDate}",
import * as alexa from 'ask-sdk-core';
import {HandlerInput} from 'ask-sdk-core';
import {Response} from 'ask-sdk-model';
import {SessionAttributes} from '../model/sessionAttributes';
export const saveAttributesResponseInterceptor = {
async process(handlerInput: HandlerInput, response: Response) {
if (!response) return; // avoid intercepting calls that have no outgoing response due to errors
const {attributesManager, requestEnvelope} = handlerInput;
import * as alexa from 'ask-sdk-core';
import {HandlerInput} from 'ask-sdk-core';
import {SessionAttributes} from '../model/sessionAttributes';
export const loadAttributesRequestInterceptor = {
async process(handlerInput: HandlerInput) {
const {attributesManager, requestEnvelope} = handlerInput;
if (alexa.isNewSession(requestEnvelope)) {
const persistentAttributes = await attributesManager.getPersistentAttributes();
let sessionAttributes: SessionAttributes;
const persistentAttributes = await handlerInput.attributesManager.getPersistentAttributes();
// Do stuff
attributesManager.setPersistentAttributes({// Persistente data});
await attributesManager.savePersistentAttributes();
exports.handler = alexa.SkillBuilders.custom()
.addRequestHandlers(
launchRequestHandler,
addTvShowIntentHandler,
tvShowRecommendationIntentHandler,
helpIntentHandler,
cancelAndStopIntentHandler,
fallbackIntentHandler,
sessionEndedRequestHandler,
intentReflectorHandler
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.d08ed728-0d06-4ec0-ba6a-ad217d92bcb2",
"application": {
"applicationId": "amzn1.ask.skill.e6b8a7c8-8d5e-4a4d-aeb4-755d250f474d"
},
"attributes": {
"comida": "pizza"
{
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>Puedes comer pizza en: Pizzeria Lucio, Pizzeria Donatello, Al rico tiramisú, Pasta al dente</speak>"
},
"shouldEndSession": false,
"type": "_DEFAULT_RESPONSE"
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.d08ed728-0d06-4ec0-ba6a-ad217d92bcb2",
"application": {
"applicationId": "amzn1.ask.skill.e6b8a7c8-8d5e-4a4d-aeb4-755d250f474d"
},
"user": {
"userId": "amzn1.ask.account.AGLW474IZG3UAHXPAHXBIG3USCXSUZAKHJEXXOKDHV7PLBTCKXI3FFWRAOFOHMFU7RENRIQ5GEGOPMHOESWUFN4GNUBZXEPEEEPZ3KV5C7SUTZXIPLNDAZUKKMXO53CBQP5FU33PYRDWMRJIHJUBY433FLJSTHQPJ7RN46E4S7ITUP5RLFD7WLGQ7JMLUQEYW5IXUUZOWT7I2KA"
{
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>hey, ¿qué te apetece comer hoy?</speak>"
},
"reprompt": {
"outputSpeech": {
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.d08ed728-0d06-4ec0-ba6a-ad217d92bcb2",
"application": {
"applicationId": "amzn1.ask.skill.e6b8a7c8-8d5e-4a4d-aeb4-755d250f474d"
},
"user": {
"userId": "amzn1.ask.account.AGLW474IZG3UAHXPAHXBIG3USCXSUZAKHJEXXOKDHV7PLBTCKXI3FFWRAOFOHMFU7RENRIQ5GEGOPMHOESWUFN4GNUBZXEPEEEPZ3KV5C7SUTZXIPLNDAZUKKMXO53CBQP5FU33PYRDWMRJIHJUBY433FLJSTHQPJ7RN46E4S7ITUP5RLFD7WLGQ7JMLUQEYW5IXUUZOWT7I2KA"