question

Joel Bion avatar image
Joel Bion asked

Want to include short APL Document in my node.js 'index.js' file

I program a custom Alexa skill in node.js. I have made a few very trivial APL Documents that I need to regularly use and I am in the process of updating them. It would speed my personal workflow tremendously if I could somehow include the actual APL documents JSON in the index.js fille itself, and reference them in the same file. Is there any way to do that? THANKS!

apl
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Andy Whitworth avatar image
Andy Whitworth answered

Just define the JSON structures as const variables and reference that variable in your APL directive.

const APLDoc = {
// APL document JSON in here
}


 responseBuilder.addDirective({
  
  type: 'Alexa.Presentation.APL.RenderDocument',
  token: HELLO_WORLD_TOKEN,           
  document: APLDoc 
});

Also, read the following ref doc on how to store JSON APL docs as part of your deployment package and reference them in your skill

https://developer.amazon.com/en-US/docs/alexa/alexa-presentation-language/use-apl-with-ask-sdk.html


10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.