Skip to content

davidmenger/botnaut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

920882a · May 23, 2018

History

1 Commit
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018
May 23, 2018

Repository files navigation

Botnaut - DEPRECATED

Use wingbot instead!

==============

CircleCI

Framework for building reusable chatbot components. Routing, Keyword recognition is built-in.

Requirements and installation

  • requires mongoose > 4.0
  • requires nodejs > 6.0
  • requires express > 4.0
  • requires body-parser > 1.10
$ npm i -S botnaut

Basic setup with Express

It's easy. This basic example can handle everything.

const express = require('express');
const { Router } = require('botnaut');
const mongoose = require('mongoose');
const { createRouter, createProcessor } = require('botnaut/express');

const bot = new Router();

bot.use('/hello', (req, res, postBack) => {
    res.text('Hello world');
});

bot.use((req, res, postBack) => {
    res.text('What you want?', {
        hello: 'Say hello world'
    });
});

const processor = createProcessor(bot, {
    pageToken: 'pagetokenhere',
    appSecret: 'botappsecret',
    autoTyping: true
});

const app = express();

app.use('/bot', createRouter(processor, 'verifyTokenHere'));

mongoose.connect('mongodb://localhost/myapp')
    .then(() => app.listen(3000));