alexa-js/alexa-app

Cannot get directive display to work in Alexa skill.

secondsea opened this issue · 5 comments

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();

},
};

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

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

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.

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.

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 :)