0.0.3 • Published 9 years ago

alexa-botkit v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

Alexa Botkit

npm version NPM Status

This library allows you to use the alexa platform on botkit

Installation

 $ npm install --save alexa-botkit

Usage

import alexa from 'alexa-botkit';

// create a new alexa controller
const controller = alexa({});

const bot = controller.spawn({});

controller.setupWebserver(3001, () => {
  controller.createWebhookEndpoints(controller.webserver, bot);
});

Each message has a alexa request object embedded into it to make life easier.

import AlexaResponse from 'alexa-response';

// the first param is the alexa intent
controller.hears('GetHoroscope', 'message_received', (bot, message) => {
  // get the sign the user is looking for
  const sign = message.alexa.getSlotValue('signsslot');
  const reply = AlexaResponse
        .say(`Your ${sign} horoscope is...`)
        .card({ title: `${sign} Horoscope`, content: "..."});
  // do not run the `.build()` function from `AlexaResponse` we check if
  // the reply is a string and if it is we will create a `say` response otherwise
  // we assume that you have make a custom reply using `AlexaResponse` and we will
  // run the `.build()` for you
  bot.reply(message, reply)
})
0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago