O'Reilly logo

Alexa Skills Projects by Madhur Bhargava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating the Factly Lambda Code to Introduce Persistence

We shall start the modification of the Lambda code by including the AWS dependency first:

  1. Add the following lines of code in the very beginning of the Lambda code (the index.js file):
var AWS = require('aws-sdk');var docClient = new AWS.DynamoDB.DocumentClient();

Here, we include the AWS SDK and then use it to get an instance of the DynamoDB.DocumentClient instance, which will help us in reading and writing data to and from DynamoDB.

  1. Next, modify the onLaunch method from the one given in the following code (which we wrote earlier):
function onLaunch(launchRequest, session, callback) {    getWelcomeResponse(callback);}

Modify it to this:

function onLaunch(launchRequest, session, callback) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required