How to use the ask-sdk-dynamodb-persistence-adapter.DynamoDbPersistenceAdapter function in ask-sdk-dynamodb-persistence-adapter

To help you get started, we’ve selected a few ask-sdk-dynamodb-persistence-adapter 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-games / skills-gameon-sdk-js / samples / word-word-lite / src / index.js View on Github external
/*
 *  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 *  Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *  SPDX-License-Identifier: Apache-2.0
 *  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 */

const Alexa = require('ask-sdk-core');
const WordConstants = require('./words.js');
const GameOn = require('./gameOn.js');

const {DynamoDbPersistenceAdapter} = require('ask-sdk-dynamodb-persistence-adapter');
const persistenceAdapter = new DynamoDbPersistenceAdapter({
  tableName: 'WordWordLitePersistence',
  createTable: true
});

const PlayGameRequestHandler = {
  canHandle(handlerInput) {
    this.handlerInput = handlerInput;
    return this.requestType === 'IntentRequest' && this.intentName === 'PLAY_GAME_INTENT';
  },
  async handle(handlerInput) {
    this.handlerInput = handlerInput;
    const attributes = this.getSessionAttributesManager;
    const player = await this.getPersistentAttributesManager;

    // Update score from count of user utterances.
    const matchWord = attributes.currentWord.toLowerCase();
github internetarchive / internet-archive-voice-apps / functions / src / platform / alexa / handler / index.js View on Github external
module.exports = (actions) => {
  // TODO: we don't need it for session attributes
  // turn on once we will have persistent attributes
  const region = process.env.AWS_REGION || 'us-west-1';
  debug('set AWS region', region);

  const dynamoDbPersistenceAdapter = new DynamoDbPersistenceAdapter({
    createTable: true,
    dynamoDBClient: new AWS.DynamoDB({ apiVersion: 'latest', region }),
    tableName: process.env.DYNAMO_DB_SESSION_TABLE || 'InternetArchiveSessions',
  });

  const handlers = handlersBuilder(actions);
  debug(`We can handle intents: ${handlers.map(({ intent }) => `"${intent}"`).join(', ')}`);

  let lambda = Alexa.SkillBuilders.custom()
    .addRequestHandlers(...handlers)
    .addErrorHandlers(ErrorHandler)
    .addRequestInterceptors(
      () => pipeline.stage(pipeline.PROCESS_REQUEST)
    )
    .addRequestInterceptors(LogInterceptor)
    .addResponseInterceptors(

ask-sdk-dynamodb-persistence-adapter

DynamoDB based implementation package of PersistenceAdapter interface in ASK SDK v2 for Node.js

Apache-2.0
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis