I create a hello world skill to test APL but I can't see anything in the simulator, even if in output there seems to be no problem. I used a test template generated with the authoring tool. I don't understand where the problem is?
/* eslint-disable func-names */ /* eslint-disable no-console */ const Alexa = require('ask-sdk-core'); const LaunchRequestHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'LaunchRequest'; }, handle(handlerInput) { const speechText = 'Welcome to the Alexa Skills Apulia, you can say hello!'; return handlerInput.responseBuilder .speak(speechText) .reprompt(speechText) .withSimpleCard('Hello World', speechText) .addDirective({ type: 'Alexa.Presentation.APL.RenderDocument', version: '1.0', document: require("main.json"), datasources: {} }) .getResponse(); }, }; const HelloWorldIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'HelloWorldIntent'; }, handle(handlerInput) { const speechText = 'Hello World!'; return handlerInput.responseBuilder .speak(speechText) .withSimpleCard('Hello World', speechText) .getResponse(); }, }; const HelpIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.HelpIntent'; }, handle(handlerInput) { const speechText = 'You can say hello to me!'; return handlerInput.responseBuilder .speak(speechText) .reprompt(speechText) .withSimpleCard('Hello World', speechText) .getResponse(); }, }; const CancelAndStopIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && (handlerInput.requestEnvelope.request.intent.name === 'AMAZON.CancelIntent' || handlerInput.requestEnvelope.request.intent.name === 'AMAZON.StopIntent'); }, handle(handlerInput) { const speechText = 'Goodbye!'; return handlerInput.responseBuilder .speak(speechText) .withSimpleCard('Hello World', speechText) .getResponse(); }, }; const SessionEndedRequestHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'SessionEndedRequest'; }, handle(handlerInput) { console.log(`Session ended with reason: ${handlerInput.requestEnvelope.request.reason}`); return handlerInput.responseBuilder.getResponse(); }, }; const ErrorHandler = { canHandle() { return true; }, handle(handlerInput, error) { console.log(`Error handled: ${error.message}`); return handlerInput.responseBuilder .speak('Sorry, I can\'t understand the command. Please say again.') .reprompt('Sorry, I can\'t understand the command. Please say again.') .getResponse(); }, }; const skillBuilder = Alexa.SkillBuilders.custom(); exports.handler = skillBuilder .addRequestHandlers( LaunchRequestHandler, HelloWorldIntentHandler, HelpIntentHandler, CancelAndStopIntentHandler, SessionEndedRequestHandler ) .addErrorHandlers(ErrorHandler) .lambda();
{ "body": { "version": "1.0", "response": { "outputSpeech": { "type": "SSML", "ssml": "Welcome to the Alexa Skills Apulia, you can say hello!" }, "card": { "type": "Simple", "title": "Hello World", "content": "Welcome to the Alexa Skills Apulia, you can say hello!" }, "directives": [ { "type": "Alexa.Presentation.APL.RenderDocument", "document": { "document": { "type": "APL", "version": "1.0", "theme": "dark", "import": [ { "name": "alexa-layouts", "version": "1.0.0" } ], "resources": [ { "description": "Stock color for the light theme", "colors": { "colorTextPrimary": "#151920" } }, { "description": "Stock color for the dark theme", "when": "${viewport.theme == 'dark'}", "colors": { "colorTextPrimary": "#f0f1ef" } }, { "description": "Standard font sizes", "dimensions": { "textSizeBody": 48, "textSizePrimary": 27, "textSizeSecondary": 23, "textSizeSecondaryHint": 25 } }, { "description": "Common spacing values", "dimensions": { "spacingThin": 6, "spacingSmall": 12, "spacingMedium": 24, "spacingLarge": 48, "spacingExtraLarge": 72 } }, { "description": "Common margins and padding", "dimensions": { "marginTop": 40, "marginLeft": 60, "marginRight": 60, "marginBottom": 40 } } ], "styles": { "textStyleBase": { "description": "Base font description; set color", "values": [ { "color": "@colorTextPrimary" } ] }, "textStyleBase0": { "description": "Thin version of basic font", "extend": "textStyleBase", "values": { "fontWeight": "100" } }, "textStyleBase1": { "description": "Light version of basic font", "extend": "textStyleBase", "values": { "fontWeight": "300" } }, "mixinBody": { "values": { "fontSize": "@textSizeBody" } }, "mixinPrimary": { "values": { "fontSize": "@textSizePrimary" } }, "mixinSecondary": { "values": { "fontSize": "@textSizeSecondary" } }, "textStylePrimary": { "extend": [ "textStyleBase1", "mixinPrimary" ] }, "textStyleSecondary": { "extend": [ "textStyleBase0", "mixinSecondary" ] }, "textStyleBody": { "extend": [ "textStyleBase1", "mixinBody" ] }, "textStyleSecondaryHint": { "values": { "fontFamily": "Bookerly", "fontStyle": "italic", "fontSize": "@textSizeSecondaryHint", "color": "@colorTextPrimary" } } }, "layouts": {}, "mainTemplate": { "parameters": [ "payload" ], "items": [ { "type": "Container", "height": "100vh", "items": [ { "type": "Image", "source": "${payload.bodyTemplate6Data.backgroundImage.sources[0].url}", "scale": "best-fill", "width": "100vw", "height": "100vh", "position": "absolute" }, { "type": "AlexaHeader", "headerAttributionImage": "${payload.bodyTemplate6Data.logoUrl}" }, { "type": "Container", "grow": 1, "justifyContent": "${viewport.shape == 'round' ? 'center' : 'end'}", "items": [ { "paddingLeft": "@marginLeft", "paddingRight": "@marginRight", "type": "Text", "text": "${payload.bodyTemplate6Data.textContent.primaryText.text}", "style": "textStyleBody", "textAlign": "${viewport.shape == 'round' ? 'center' : 'left'}" } ] }, { "when": "${viewport.shape != 'round'}", "type": "AlexaFooter", "footerHint": "${payload.bodyTemplate6Data.hintText}" } ] } ] } }, "datasources": { "bodyTemplate6Data": { "type": "object", "objectId": "bt6Sample", "backgroundImage": { "contentDescription": null, "smallSourceUrl": null, "largeSourceUrl": null, "sources": [ { "url": "https://d2o906d8ln7ui1.cloudfront.net/images/BT6_Background.png", "size": "small", "widthPixels": 0, "heightPixels": 0 }, { "url": "https://d2o906d8ln7ui1.cloudfront.net/images/BT6_Background.png", "size": "large", "widthPixels": 0, "heightPixels": 0 } ] }, "image": { "contentDescription": null, "smallSourceUrl": null, "largeSourceUrl": null, "sources": [ { "url": "http://images.media-allrecipes.com/userphotos/250x250/303241.jpg", "size": "small", "widthPixels": 0, "heightPixels": 0 }, { "url": "http://images.media-allrecipes.com/userphotos/250x250/303241.jpg", "size": "large", "widthPixels": 0, "heightPixels": 0 } ] }, "textContent": { "primaryText": { "type": "PlainText", "text": "Welcome to The Daily Cheese" } }, "logoUrl": "https://d2o906d8ln7ui1.cloudfront.net/images/cheeseskillicon.png", "hintText": "Try, \"Alexa, what is today's cheesy joke?\"" } } }, "datasources": {} } ], "reprompt": { "outputSpeech": { "type": "SSML", "ssml": "Welcome to the Alexa Skills Apulia, you can say hello!" } }, "shouldEndSession": false, "type": "_DEFAULT_RESPONSE" }, "sessionAttributes": {}, "userAgent": "ask-node/2.5.2 Node/v8.10.0" } }