How to use the ask-sdk.DefaultApiClient function in ask-sdk

To help you get started, we’ve selected a few ask-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexa / alexa-cookbook / feature-demos / skill-demo-list-events / lambda / custom / index.js View on Github external
// exports

const skillBuilder = Alexa.SkillBuilders.custom();
exports.handler = skillBuilder
  .addRequestHandlers(
    AmazonCancelStopHandler,
    AmazonHelpHandler,
    LaunchRequestHandler,
    SkillEventHandler,
    ItemEventHandler,
    ListEventHandler,
    SessionEndedHandler,
    UnhandledHandler,
  )
  .addErrorHandlers(ErrorHandler)
  .withApiClient(new Alexa.DefaultApiClient())
  .withCustomUserAgent('cookbook/list-events/v1')
  .lambda();
github alexa / alexa-cookbook / feature-demos / skill-demo-progressive-response / lambda / custom / index.js View on Github external
}

// 4. Exports handler function and setup ===================================================
const skillBuilder = Alexa.SkillBuilders.custom();
exports.handler = skillBuilder
  .addRequestHandlers(
    LaunchRequestHandler,
    AmazonCancelStopNoHandler,
    AmazonHelpHandler,
    InProgressGetFirstEventHandler,
    GetFirstEventHandler,
    AmazonYesHandler,
    SessionEndedHandler,
  )
  .addErrorHandlers(ErrorHandler)
  .withApiClient(new Alexa.DefaultApiClient())
  .withCustomUserAgent('cookbook/progressive-response/v1')
  .lambda();
github alexa / alexa-cookbook / feature-demos / skill-demo-list-access / lambda / custom / index.js View on Github external
}

// exports

const skillBuilder = Alexa.SkillBuilders.custom();
exports.handler = skillBuilder
  .addRequestHandlers(
    AmazonCancelStopHandler,
    AmazonHelpHandler,
    LaunchRequestHandler,
    CompleteTopToDoHandler,
    TopToDoHandler,
    SessionEndedHandler,
  )
  .addErrorHandlers(ErrorHandler)
  .withApiClient(new Alexa.DefaultApiClient())
  .withCustomUserAgent('cookbook/list-access/v1')
  .lambda();
github taimos / ask-sdk-test / examples / skill-sample-nodejs-dynamodb / helloworld.ts View on Github external
&& handlerInput.requestEnvelope.request.intent.name === 'SayGoodbye';
    }

    public async handle(handlerInput : HandlerInput) : Promise {
        const attributes = await handlerInput.attributesManager.getPersistentAttributes();
        return handlerInput.responseBuilder.speak(`Bye ${attributes.foo}!`).getResponse();
    }
}

export const handler : LambdaHandler = SkillBuilders.custom()
    .withPersistenceAdapter(new DynamoDbPersistenceAdapter({
        tableName: 'TestTable',
        partitionKeyName: 'userId',
        attributesName: 'mapAttr',
    }))
    .withApiClient(new DefaultApiClient())
    .addRequestHandlers(
        new SayHelloHandler(),
        new SayGoodbyeHandler(),
    )
    .lambda();
github taimos / ask-sdk-test / examples / skill-sample-nodejs-profileapi / helloworld.ts View on Github external
const mobile = await upsServiceClient.getProfileMobileNumber();

            const speechText = `Hello, ${givenName} ${name}. Your e-mail is ${email} and your phone number is ${mobile}`;
            return handlerInput.responseBuilder.speak(speechText).getResponse();
        } catch (e) {
            return handlerInput.responseBuilder.speak('Hello, world! I am not allowed to view your profile.').getResponse();
        }
    }

}

export const handler : LambdaHandler = SkillBuilders.custom()
    .addRequestHandlers(
        new LaunchRequestHandler(),
    )
    .withApiClient(new DefaultApiClient())
    .lambda();
github alexa / alexa-skills-kit-sdk-for-nodejs / ask-sdk-v1adapter / lib / adapter.ts View on Github external
function EmitEvent() : void {
    const packageInfo = require('../package.json');
    this.state = this._event.session.attributes.STATE || '';

    SkillBuilders.custom()
                 .addRequestHandlers(new Handler(this), ...this.v2RequestHandlers)
                 .addRequestInterceptors(new CopySessionAttributesInterceptor())
                 .withPersistenceAdapter(dynamoDbPersistenceAdapter)
                 .withApiClient(new DefaultApiClient())
                 .withCustomUserAgent(`${packageInfo.name}/${packageInfo.version}`)
                 .create()
                 .invoke(this._event, this._context)
                 .then((responseEnvelope) => {
                    if (typeof this._callback === 'undefined') {
                        this._context.succeed(responseEnvelope);
                    } else {
                        this._callback(null, responseEnvelope);
                    }
                })
                 .catch((err) => {
                    if (typeof this._callback === 'undefined') {
                        this._context.fail(err);
                    } else {
                        this._callback(err);
                    }

ask-sdk

Standard distribution package for Alexa Skills Kit SDK

Apache-2.0
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis