Giter VIP home page Giter VIP logo

messenger-bot-wit-boilerplate's Introduction

Facebook Messenger Chatbot Boilerplate

Boilerplate project for developing Facebook Messenger Bot powered by Wit.ai, MongoDB and Redis as a session store. This boilerplate will allow you to bootstrap your chatbot within 8 minutes, all you need is wit.ai application setup, Facebook page, Facebook app and running MongoDB and Redis.

External dependencies

Wit.ai

The AI engine used in this boilerplate is wit.ai, please make sure to create a new app in the wit.ai dashboard.

MongoDB

This boilerplate is using MongoDB for storing user's data and for tracking their last activity with the bot Please install MongoDB v3 or greater and setup connection in the config/config.js

By default the in the development environment chatbotdb database will be created

Session store using Redis

Redis server is required for managing sessions and keeping the context with each user. Please install Redis and setup connection in the config/config.js

Setup

npm install

Configuration

Set environment variables or write values directly in the config/config.js

FB_PAGE_TOKEN - Access token generated for the Facebook application to allow making Graph API requests to the page

WIT_TOKEN - WIT server side token

FB_WEBHOOK_VERIFY_TOKEN - a verify token that should be used for Webhooks setup, this is something you need to generate by yourself

FB_PAGE_ID - ID of the Facebook page that will be used as a bot.

Run

In order to run and test chatbot it is required to have server running with secured connection. For that you can use ngrok

install ngrok and run

./ngrok http 3000

run the server

npm start

to enable debug mode DEBUG=* npm start or DEBUG=cbp* npm start for app level log messages only

update Facebook application's webhook

https://xxxxxxxx.ngrok.io/bot enter the FB_VERIFY_TOKEN value and submit

Project structure

  actions/ 
    - define custom wit.ai actions here, the file name should be the name of the action, all actions from this folder are automatically registered as wit.ai actions.
    
  config/
    - configuration files for access keys, tokens, connection strings
    
  handlers/
    - messenger event handlers for text messages, attachments, postbacks and quick replies
    
  init/
    - init scripts for mongodb and redis
    
  schemas/ 
    - mongodb/mongoose schemas 
    
  scripts/ 
    - shell scripts for messenger greeting text, persistant menu and getting started button setup
    
  services/ 
    - custom services
  
  app.js
    - application entry point

  graphAPI.js
    - Facebook Graph API helper
    
  platformHelpers.js
    - Helpers for generating message templates, e.g send location, quick replies and others
    
  routes.js
    - express routes setup and message handler delegation

  sessionStore.js
    - Redis based session store
    
  wit.js
    - wit.ai setup with actions loading
    
  witHelpers.js
    - helpers for extracting entities from wit.ai response
    
  

The Roadmap

  • Redis session store
  • Automatic actions binding
  • User info tracking in the database
  • Saving last and previous geo locations shared by user
  • Demo of send location, quick replies
  • Shell scripts for adding greeting message, persistent menu and getting started button
  • Demo of generic template
  • Demo of list template
  • Unit tests

ChatBotKitchen project

made with love ❤️ in Armenia by Simply Technologies

messenger-bot-wit-boilerplate's People

Contributors

aadamyan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

messenger-bot-wit-boilerplate's Issues

mongoose-q

Hello , I think this package might be long time deprecated ?
Think can use official mongoose package since promises are handled natively now ? What do you suggest ? Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.