Inspiration

As the off season for our club frisbee team approaches, we often struggle to stay motivated and work out. One great way to help us stay healthy and in-shape is by creating a community chat where we share our workouts in order to motivate our teammates. We use GroupMe to do so, however it is easy for individual workouts and announcements to get lost. Enter SwoleBot.

What it does

At its core, SwoleBot is a workout tracker. Each time someone sends a photo of their workout in the chat, we record that workout for them and anyone they "@" mention in our database. We use keyword matching to determine the type of workout performed. These records allow us to then ask the bot for a leaderboard of who has been working out the most, inspiring friendly competition among the team.

In addition to tracking workouts, SwoleBot helps us track our events. Any team member can easily add athletic trainer hours to a shared google calendar through the bot, and these hours can be retrieved through the bot at a later time. Additionally, other team events may also be retrieved through the bot.

Lastly, SwoleBot is scheduled to send a motivational message including the day's events to the group every morning, and can be asked for further information on how to use the bot.

How we built it

SwoleBot is built using a google cloud function as a serverless backend. The function is activated either by a callback from the GroupMe bot API when a message is sent, or by the Google Cloud Scheduler API to send messages at specific times. Built using python, the function interfaces with the GroupMe bot API to send messages, the GroupMe user API to store user info, and the Google Calendar API to add and retrieve calendar events, including adding Calendar events with natural language. The function uses the firestore nonrelational database to store records of each team member's workouts and generate the leaderboard.

Challenges we ran into

Configuring the deployment pipeline and linking together the various GCP services was an interesting challenge. Especially gaining authentication to the Google Calendar API without a stateful backend was difficult.

Additionally, we had a strong focus on keeping invocations within the free tier limits, meaning optimizing the number of function and database calls; while being scalable enough to use by the full team every day.

Conclusions

It was amazing to write the bot within 24 hours to include all these features, learning several new APIs, GCP services, and tying it all together. Further work includes the addition of more NLP to further track workouts specifically and make bot interaction more natural.

Built With

Share this project:

Updates