async handle()

in lambda/src/index.ts [98:131]


    async handle(handlerInput) {
        const dialogState = Alexa.getDialogState(handlerInput.requestEnvelope)
        const confirmationStatus = (handlerInput.requestEnvelope.request as IntentRequest).intent.confirmationStatus
        console.log(handlerInput)

        if (dialogState !== 'COMPLETED') {
            // ダイアログモデルのスロット質問中の場合
            return handlerInput.responseBuilder
                .addDelegateDirective()
                .getResponse();
        } else {
            // ダイアログモデルのスロットが全て埋まった場合
            if (confirmationStatus !== 'CONFIRMED') {
                // 予約確認Alexa応答に対して「いいえ」発話時
                // 予定登録キャンセル
                return handlerInput.responseBuilder
                    .speak('予定の登録をキャンセルします')
                    .withShouldEndSession(true)
                    .getResponse();
            }

            const garoxaContloller = new GaroxaController()
            await garoxaContloller.registerAllDaySchedule({
                name: Alexa.getSlotValue(handlerInput.requestEnvelope, "Name"),
                date: Alexa.getSlotValue(handlerInput.requestEnvelope, "CheckInDate")
            })

            // 予約確認Alexa応答に対して「はい」発話時
            return handlerInput.responseBuilder
                .speak('予定を登録しました')
                .withShouldEndSession(true)
                .getResponse();
        }
    }