This is the Facebook Messenger chatbot for microwork made by group 6 for the course IN4325 Information Retrieval.
Go to the Facebook page and click 'Message' to chat with our bot. You need to be added as developer or tester of the Facebook app, otherwise it will give you the silent treatment. If you post your Facebook account name on our slack channel, we will add you as soon as possible.
The project directories and files are structured in the following tree:
setup.pyruns worker API, requester API and chatbotapiapiserver.pywebserver that contains logic for the requester and worker APIdatabase.pyinitializes database configurationmodel.pydatamodel used by both API'stestsintegration tests for both API's
chatbotapi_helper.pyhelper methods to call the worker APIchatbot.pyentry point of chatbot, uses messaging and logger functionalityfacebook_helper.pyhelper methods to call Facebook API and Facebook-specific functionalitylocal_test.pytests communication with chatbot without having to use the Facebook interfacelogger.pywraps (heroku) logging functionalitymessaging.pylogic to handle the chatbot interaction flow by reading user messages and replying according to current chatbot state
pipelinespipeline_1.pypipeline for Albert Heijn Twitter WebCare evaluation task (Type 1: global content)pipeline_2.pypipeline for Albert Heijn floor plan evaluation task (Type 2: local content)pipeline_3.pypipeline for Albert Heijn store stocking evaluation task (Type 3: content generation)reviewPipeline.pypipeline for generation of review tasks
The following paragraph describe how to set up the project to run and test it locally.
To run the chatbot (on Windows) execute the following steps:
- Make sure you have installed Python 3 (I used 3.6) and Heroku CLI. I also assume you have Git installed and know how it works.
pip install virtualenvwrapper-winto install the virtualenv stuff we are going to use. For Unix you need to installvirtualenvwrappermkvirtualenv chatbotto enter our virtual environment. It doesn't matter how you call it, but it's useful to remember how you call it.pip install -r requirements.txtto locally install project dependencies in the virtual environment
If you run a Unix machine I assume you know how to adapt the above instructions to your own machine.
heroku git:remote -a fathomless-cove-38602adds the Heroku app to the local git to push the code to. You need to be added to the Heroku app for this to work.- Execute
workon chatbotto re-enter the virtual environment if you come back to develop. - Execute
git push heroku masterto deploy the chatbot to Heroku. In order to push a branch different than master to Heroku, executegit push heroku your-branch-name:master. - You can run the chatbot locally with
heroku local. This will allow you to run the application locally, with the heroku database. If you have MySQL installed you can also run the app with your local database. In order to do this you need to enter your database settings inapi/config/settings.json, and run the server app withpython ./setup.py.
- Once you have the app running locally you can run the API tests using
python -m unittest discover.
To test the communication between the chatbot and facebook do the following:
- Add a new Environment variable to your machine, with name
PAGE_ACCESS_TOKENand as value the token which can be found in Heroku at Settings -> Config vars - Run the server locally as described above using the
heroku localcommand, this will start the server at localhost:5000 - Start the chatbot/local_test.py script and follow the instructions