1.0.8 • Published 6 years ago
alexa-skill-sdk-for-azure-function v1.0.8
alexa-skill-sdk-for-azure-function
Alexa skill sdk for Node.js for azure function. It's a wrapper of Alexa skills kit sdk for Node js for Azure Function
Installation
$ npm install alexa-skill-sdk-for-azure-function
Usage
In index.js of azure function
module.exports = function (context, req) {
var alexa = require('alexa-skill-sdk-for-azure-function');
alexa.setup({
azureCtx: context,
azureReq: req,
handlers: null,
trackInvokedIntents: true,
enforceVerifier: false,
i18nSettings: i18nSettings
});
alexa.execute(avsCallback(context, req));
}
var avsCallback = function (azureCtx, req) {
return function (err, obj) {
if (err) {
azureCtx.res = {
status: 400,
body: err
};
} else {
azureCtx.res = {
body: obj
};
}
azureCtx.done();
};
};
Options to setup alexa sdk for azure function:
- azureCtx: The context of azure function
- azureReq: The request object of azure function (http trigger)
- handlers: Array of Handlers for alexa skill
- trackInvokedIntents If you want to track invoked intents, then this would be stored in session attributes as invokedIntents: string[] and lastIntent: string. Default value: false
- enforceVerifier If you want to enforce certificate verification for alexa, then pass the "true" boolean flag. Default value: true
- alexaAppId This would be app id of your alexa skill. You can either pass this through this property or set the app settings of "ALEXA_APP_ID"
- i18nSettings This is the setting for i18next. It should be an object of two properties
{
"interpolation": object,
"languageStrings": object
}
- version Version of the application
- name Name of the application