Alexa Lambda Integration with Skills SDK and NPM
Create a Skill API key
Each Skill needs its own API key for tracking.
Create a Skill to get an API key.
Install Dashbot via NPM
npm install --save dashbot
Include Dashbot
Use the API key created above.
const dashbot = require('dashbot')(process.env.DASHBOT_API_KEY).alexa;
Wrap your handler in the Dashbot handler call
before:
exports.handler = (event, context, callback) => {const alexa = Alexa.handler(event, context);alexa.appId = APP_ID;alexa.resources = languageString;alexa.registerHandlers(newSessionHandlers, startStateHandlers, triviaStateHandlers, helpStateHandlers);alexa.execute();};
after:
exports.handler = dashbot.handler((event, context, callback) => {const alexa = Alexa.handler(event, context);alexa.appId = APP_ID;alexa.resources = languageString;alexa.registerHandlers(newSessionHandlers, startStateHandlers, triviaStateHandlers, helpStateHandlers);alexa.execute();});
You’re all set!
Example
Using the Alexa Skills Kit SDK for Node.js and AWS Lambda, it is easy to integrate Dashbot.
We have added Dashbot to these three sample Alexa Skills: