Skip to content

davidmenger/botnaut

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));