How to use the ask-sdk.SkillBuilders.custom 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 taimos / ask-sdk-test / examples / skill-sample-nodejs / helloworld.ts View on Github external
public handle(handlerInput : HandlerInput) : Response {
        const speechText = 'Hello World!';

        const attributes = handlerInput.attributesManager.getSessionAttributes();
        attributes.foo = 'bar';
        attributes.count = 1;
        handlerInput.attributesManager.setSessionAttributes(attributes);

        return handlerInput.responseBuilder
            .speak(speechText)
            .withSimpleCard('Hello World', speechText)
            .getResponse();
    }
}

export const handler : LambdaHandler = SkillBuilders.custom()
    .addRequestHandlers(
        new LaunchRequestHandler(),
        new HelloWorldIntentHandler(),
    )
    .lambda();
github taimos / ask-sdk-test / examples / skill-sample-nodejs-profileapi / helloworld.ts View on Github external
try {
            const name = await upsServiceClient.getProfileName();
            const givenName = await upsServiceClient.getProfileGivenName();
            const email = await upsServiceClient.getProfileEmail();
            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 taimos / ask-sdk-test / examples / skill-sample-nodejs-multistring / helloworld.ts View on Github external
|| (handlerInput.requestEnvelope.request.type === 'IntentRequest'
                && handlerInput.requestEnvelope.request.intent.name === 'HelloWorldIntent');
    }

    public handle(handlerInput : HandlerInput) : Response {
        const speech = ['Hello, how are you?', 'Hi, what\'s up?', 'Good day, how are you doing?'];
        const reprompt = ['How are you?', 'How do you feel?'];
        return handlerInput.responseBuilder
            .speak(speech[Math.floor(Math.random() * speech.length)])
            .reprompt(reprompt[Math.floor(Math.random() * reprompt.length)])
            .getResponse();
    }

}

export const handler : LambdaHandler = SkillBuilders.custom()
    .addRequestHandlers(
        new LaunchRequestHandler(),
    )
    .lambda();
github taimos / ask-sdk-test / examples / skill-sample-nodejs-audioplayer / audioplayer.ts View on Github external
class ResumeIntentHandler implements RequestHandler {

    public canHandle(handlerInput : HandlerInput) : boolean {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
            && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.ResumeIntent';
    }

    public handle(handlerInput : HandlerInput) : Response {
        const offset = handlerInput.requestEnvelope.context.AudioPlayer ? handlerInput.requestEnvelope.context.AudioPlayer.offsetInMilliseconds || 0 : 0;
        return handlerInput.responseBuilder
            .addAudioPlayerPlayDirective('REPLACE_ALL', 'https://superAudio.stream', 'superToken', offset, 'superToken')
            .getResponse();
    }
}

export const handler : LambdaHandler = SkillBuilders.custom()
    .addRequestHandlers(
        new LaunchRequestHandler(),
        new PlayStreamIntentHandler(),
        new ClearQueueIntentHandler(),
        new StopAudioHandler(),
        new ResumeIntentHandler(),
    )
    .lambda();
github taimos / ask-sdk-test / examples / skill-sample-nodejs-dynamodb / helloworld.ts View on Github external
}

class SayGoodbyeHandler implements RequestHandler {

    public canHandle(handlerInput : HandlerInput) : boolean {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
            && 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 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') {

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