In a previous example I created a Facebook Messenger chatbot. This project built on that to create a chat client that could offer nutritional advice on different ingredients.
However we decided that rather than build this in Facebook we would build a custom on-site chatbot so that we could reach a bigger audience and keep people engaged in the site while chatting.
Custom Javascript
In order to maintain full control of the chat flow and the data received we decided to build a custom Javascript solution rather than use and off-the-shelf third party product. This meant that we could build only the features required and keep the footprint as light as possible.
Food database
A database of different foods and nutrients was created so that editors could easily manage the content which the bot would use to create responses. In order to keep the responses as quick as possible, the data was loaded in to a Solr search index. This gave the added benefit of being able to offer suggestions for misspelled words and do fuzzy-searches. Also, Solr is lightning fast and great at handling multiple requests.