question

John Macdonald avatar image
John Macdonald asked

Repeating APL directive for each Intent Handler?

I've got skill working ok (Development stage). I've done an APL directive for the LaunchRequestHandler and that works fine (video and text on Echo Show). The APL won't show if the the skill is opened by calling it with a valid intent (fair enough -- it bypasses the LaunchRequestHandler). I can get the APL to show if I copy that into the Intent Handler that is called to open the skill (or I guess I could show a different image or whatever if I wanted), but do I have to copy the full APL directive for each Intent Handler that I want this active on? Or can I get away with just somehow alerting the system that, for this Handler there is an already defined APL directive that it can use verbatim, without my copying the full code?

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

John Macdonald avatar image
John Macdonald answered

Oh, I've worked it out. It was staring me in the face, I guess. All I have to do is to separately define an APL directive variable by something like:

const APLdirective1 = {

type: 'Alexa.Presentation.APL.RenderDocument',

document: ... <usual form of an APL directive>

... };

and then I can use it within several intent handlers with code like:

if (Alexa.getSupportedInterfaces(handlerInput.requestEnvelope)['Alexa.Presentation.APL']){

handlerInput.responseBuilder.addDirective(APLdirective1)}

It seems to work OK. Is that the way to do it?

10 |5000

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