To make it easier to run our bot, we have uploaded the complete dist/ folder to this repo - this includes the transpiled code and a config file that connects to our demo pages and databases. The Facebook data must be updated with your own data, because Messenger bots require developer apps set up to use (unless they have been verified, which is outside of project scope).
Please make sure you have nodejs (LTS - v6) installed before doing the following:
- Clone the repo
- Optionally run
make
to have a freshdist/
folder based on currentsrc/
folder
- Optionally run
- Open
dist/config/secret.json
and edit the "facebook" object with your demo page data (page access token, verify token, app secret, and app id), then save $ cd dist/
$ node src/app.js
The bot should now be running on port 443 - you can use a reverse proxy such as nginx or ngrok to tunnel the Facebook messenger webhooks to the bot instance. These tunnels must be over HTTPS (not just HTTP), otherwise Facebook will complain!
If you use the bot on the page corresponding to the data you provided in the config.json
file, it should now reply! 😊
For detailed docs on all the provided functions in the source code, visit this link. The rest of the documentation, including demo screenshots can be seen in this README right here.
- Sign up for a Wit.ai account here: https://wit.ai
- Click
https://wit.ai/AL_Allen/CampusRoomBookingBot
- Paste your server access token into the
dist/config/secret.json
file - Provide the token from Wit.ai to your Facebook bot page, in the "NLP" section in "Messenger" settings
NLP should now be available for top-level functions such as Help (type "What do I do?", or "Help me"), and finding random rooms (try "Any rooms?", or "Anything free?").
The structure of this project is as follows:
- config/
- Contains all config templates and data
- dist/
- Pre-transpiled js, which can run in Node.js LTS
- docs/
- Bot documentation, generated by documentation.js based on code comments
- nlp/
- Natural Language Processing models and entities, downloaded from our training set and data from wit.ai
- screenshots/
- Screenshots to be shown in the README below
- scripts/
- Docker and build script utilities
- src/
- Main source code folder - all business logic and code sits in here
- test/
- Some rudimentary tests
- /
- Root folder contains all js rc files, npm files, makefile, dockerfile, and README itself
Considering installing the following:
- jq: a tool for manipulating json in the CLI as it'll help with the build
- docker: where most of the build will be running
./scripts/docker-build.bash
First you'll want to make a copy of the config and enter your API keys in to config/secret.json. This file isn't commited to source so you can generate an empty one with this.
make config/secret.json
Once the server is running i'll refresh after each change to source code.
# to start server on 8080
./scripts/docker-make.bash run 8080 run
# to stop
docker kill comp9323_make__run
This runs the build, it'll wait for changes before running
# to start
./scripts/docker-make.bash devserver 1234 watch
# to stop
docker kill comp9323_make__devserver
- Allen Li
- Angus
- Zaki
This project is licensed under the MIT License - see the LICENSE.md file for details