DEV Community

Cover image for Empowering Fitness with Twilio: Your Personal GymBuddy for Seamless Communication and Progress Tracking!
Aditya Gupta
Aditya Gupta

Posted on

Empowering Fitness with Twilio: Your Personal GymBuddy for Seamless Communication and Progress Tracking!

This is a submission for Twilio Challenge v24.06.12

What I Built

GymBuddy

GymBuddy is a web application designed to help fitness enthusiasts track their workout performance and nutritional intake efficiently. Whether you're a beginner looking to establish a fitness routine or a seasoned athlete aiming to optimize your training, GymBuddy provides essential tools and insights to support your fitness journey.

Key Features

  • Performance Metrics: Track sets, reps, workout duration, and calories burned across different exercises.
  • Nutrition Tracking: Monitor meals consumed throughout the day to maintain a balanced diet.
  • Daily Quotes: Get inspired with daily motivational quotes to keep you motivated.
  • Interactive Charts: Visualize your progress with interactive charts showing performance trends over time.

Technologies Used

  • Frontend: React.js, Chakra UI
  • Backend: Flask
  • External APIs: Twilio Api for whatsapp messaging and Cohere Api for AI responses

Demo

Image description

Image description

Image description

Image description

Twilio and AI

I utilized the Cohere API to generate AI-driven content, such as daily motivational quotes and personalized workout plans based on user input. When a user fills out the form, a workout plan is dynamically generated, including meal suggestions.

For communication, I integrated the Twilio API to send messages. Upon completing their workout, users can enter details in a specific format like "10 10 50 200". Twilio then sends this data to a Flask server via its API. The Flask server interprets the message to update the dashboard with details such as 10 reps, 10 sets, 50 minutes, and 200 calories burned.

I could not have achieved this functionality without Twilio Kudos to Twilio team.

Also I had already written Blog around Twilio so I had little experience with Twilio API and Whatsapp business API.

I wanted to use Twilio Whatsapp business API but time was less as it takes verification so I sticked to using Whatsapp Sandbox.

Getting Started

To get started with GymBuddy, and follow these steps:

1.You can try it out by scanning the QR Code in the image or by texting the code join four-mental to the number +14155238886 on WhatsApp.

Image description

Once that is done clone the repository.

Source code

Watch Video Demo

Prerequisites

Before you begin, ensure you have the following installed on your development environment:

  • Python 3.x
  • Node.js
  • npm (Node Package Manager)

Join Twilio Sandbox

Screenshot (172)

Backend Setup

  1. Navigate to the backend directory:

    cd twilio/backend
    Enter fullscreen mode Exit fullscreen mode
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    Enter fullscreen mode Exit fullscreen mode
  3. Install the required Python packages:

    pip install -r requirements.txt
    Enter fullscreen mode Exit fullscreen mode
  4. Configure environment variables:

    • Create a .env file in the backend directory with the following content
      TWILIO_ACCOUNT_SID= Your SID
      TWILIO_AUTH_TOKEN=Your Auth Token
      COHERE_API_KEY=Your API KEY
      
  5. Run the backend server:

    python app.py
    Enter fullscreen mode Exit fullscreen mode

    Your Flask server will start running on http://127.0.0.1:5000/.

  6. ** Running Flask with ngrok**

    • If you want to expose your local Flask server to the internet for testing:

      choco install ngrok(in Powershell if windows)
      ngrok config add-authtoken Your AuthToken
      ngrok http 5000
      Embed the url obtained after hosting into whatsapp Sandbox settings inside When a message comes in
      Enter fullscreen mode Exit fullscreen mode

Additional Prize Categories

<!-- Does your submission qualify for any additional prize categories
Twilio Times Two: My usage of Twilio's Whatsapp Messaging API for outbound messages and the Twilio REST Client for handling incoming messages qualifies your project under the Twilio Times Two category.

Impactful Innovators: My project, GymBuddy, innovatively integrates the Cohere API and Twilio to revolutionize fitness tracking and engagement. Using Cohere, GymBuddy generates personalized motivational quotes and custom workout plans. Twilio facilitates seamless communication, enabling users to log workout details via simple text messages and receive instant updates on their progress.

<!-- Thanks for participating! →

Top comments (1)

Collapse
 
enoch91 profile image
Info Comment hidden by post author - thread only accessible via permalink
Enoch Osarenren

Hello everyone, I hope you're all doing well. I recently launched an open-source project called GraphQLPlaceholder, and I'd love your support. Please check it out and give it a star on GitHub github.com/enochval/graphql-placeh.... Your support would mean a lot to me and help immensely in the project's growth.

Thank you.

Some comments have been hidden by the post's author - find out more