0.0.3 • Published 6 years ago

lex-bot v0.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

Lex Bot

NPM

Install

yarn add lex-bot
npm install lex-bot

Usage

const lexBot = require('lex-bot')

const botSettings = {
  name: 'C3PO',
  description: 'Human-Cyborg Relations',
  abortStatements: ['shutting up sir'],
  clarificationPrompts: ['what did you say?'],
  botAliasName: 'C3PO',
}

const intents = [
  {
    name: 'Protocol',
    description: "Protocol? Why it's my primary function!",
    sampleUtterances: ['programmed for etiquette', 'programmed for protocol'],
    lambdaArn: 'arn:aws:lambda:us-east-1:123456789:function:c3-po',
  },
  {
    name: 'NoNeed',
    description: "Of course, you haven't sir.",
    sampleUtterances: [
      'I have no need for a protocol droid',
      'do not need protocol',
    ],
    lambdaArn: 'arn:aws:lambda:us-east-1:123456789:function:c3-po',
  },
  {
    name: 'Vaporators',
    description:
      'Vaporators? Sir, my first job was programming binary load-lifters',
    sampleUtterances: [
      'What I really need is a droid',
      'who understands the binary language of moisture vaporators',
    ],
    lambdaArn: 'arn:aws:lambda:us-east-1:123456789:function:c3-po',
  },
]

lexBot(botSettings, intents)
  .then(console.log)
  .catch(console.error)

Debugging

lexBot(botSettings, intents, true)

TODO:

  • Check for invalid bot, bot alias, and intent names