Arwin Edward
Arwin Edward

Reputation: 133

How can I automatically add intents to addRequestHandler

Currently, you have to add intents manually by defining it in addRequestHandlers

Alexa.SkillBuilders.custom()
            .addRequestHandlers(
                LaunchRequestHandler
            )

But is there a way How can I do it automatically for example in the loop? My intents will be in an array.

Upvotes: 1

Views: 204

Answers (1)

shradha
shradha

Reputation: 481

If your intents are inside an array then can do something like below,

    const intents = [
    LaunchRequestHandler,
    ByeIntentHandler,
    CancelAndStopIntentHandler,
    HelpIntentHandler,
    ErrorHandler
];

    let skill = Alexa.SkillBuilders.custom()
      .addRequestHandlers(
        ...intents
      )
      .create();

Upvotes: 2

Related Questions