alexa-js / alexa-app

A framework for Alexa (Amazon Echo) apps using Node.js
https://www.youtube.com/watch?v=pzM4jv7k7Rg
MIT License
1.03k stars 212 forks source link

Cannot get directive display to work in Alexa skill. #382

Closed secondsea closed 5 years ago

secondsea commented 5 years ago

In the alexa simulator i get the error there was a problem with the requested response

handle(handlerInput) { const factArr = data; const factIndex = Math.floor(Math.random() * factArr.length); const randomFact = factArr[factIndex]; const speechOutput = GET_FACT_MESSAGE + randomFact;

return handlerInput.responseBuilder
  .speak(speechOutput)
 .withSimpleCard(SKILL_NAME, randomFact)
  .addRenderTemplateDirective({
   type:'BodyTemplate1',
   token:'token1',
  backButton:'HIDDEN',
   backgroundImage:backgroundImagePath,
   title:SKILL_NAME,
  textContent:{
      type:'RichText',
      text:randomFact
  }

  })
     .getResponse();

}, };

matt-kruse commented 5 years ago

This looks like it's using the SDK, not alexa-app.

secondsea commented 5 years ago

could you elaborate? I'm really new at this.

lazerwalker commented 5 years ago

The sample code you've given makes it look like you're using the official first-party Amazon Alexa Skills Kit JS library (https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs). This repo is for a different, unrelated third-party library that is also used to create Alexa skills using JavaScript.

secondsea commented 5 years ago

correct. I am trying to add a display that has the image with the image in the background to random facts skill instead of the boring standard card.

lazerwalker commented 5 years ago

Yes. The thing is, you're asking for help with using one library, but this is the GitHub issues page for a completely different library.

You'll have much better luck opening this same issue in the repo for the Alexa Skills Kit repo I linked above — asking here is like walking into an Apple Store and asking for help with your Android phone :)