Inspiration

Current calorie tracker apps are complicated and have too many steps. We wanted to shorten the process, and remove the need to download an external app. Facebook's messenger seemed like the perfect platform, because it's available to almost everyone, on almost every device.

What it does

Our bot is able to configure a user profile upon chat request. It asks for basic information like the user's age, weight, gender, height, and goal weight. Depending on the weight, we are able to generate an estimate of the number of calories required to maintain the current weight. Then based on the goal weight, we can add or remove a set number of calories in order to determine the user's daily calorie goal.

The user is then able to send text commands to the bot like "ate 1 banana," and it's up to the bot to update the user's daily calorie count.

How we built it

We broke our application into two layers, the frontend, and the backend. We setup the frontend server with NodeJS, and used it as the primary server communicating with the Facebook Messenger API. The frontend is responsible for the conversation with the bot, and gathers the right data to send to the backend.

We built the backend on top of a LAMP stack, using PHP 5, and the Yii2 framework. The backend takes the inputs as JSON, creates or updates a user profile, and then uses Google's NLP API to determine what the text input contains. After passing the text through the NLP API, the backend receives the type of food consumed (i.e. banana), and its quantity. This is then passed to FatSecret, a nutrition API which provides us with the amount of calories consumed. This data is then logged in the MySQL database, and the number of calories is then sent back to the frontend, which passes it off to the client on Messenger.

Challenges we ran into

  • Communicating between the different parts of the application
  • FatSecret API (lack of documentation)

Accomplishments that we're proud of

  • A working demo
  • Working smoothly on top of the Google Cloud Platform`

What we learned

  • A lot about Facebook Messenger API, Google's NLP API, and the FatSecret nutrition API

What's next for FatBot

  • We want to be able to scale FatBot in order for it to handle more commands, display data to the user in a meaningful way, integrate with Google Fitness, and build support for shareable web profiles

Built With

Share this project:

Updates