Back to Parent

Outcome


Intention

The purpose of this project is to learn the basics of programming in Ruby and to use Sinatra, Heroku, and Twilio to create a web service that allows users to communicate with an SMS-compatible bot via their phones or computers.  This bot has limited functionality but can still respond to basic commands and predefined endpoints.  I chose to make it fitness-related because I wanted to create something that would be useful for me in the future.

Context

Every time I go to the gym with Manchit, he checks his phone for a list of activities to do in our workout.  Because I don't have access to his personal note, I have to follow him around whenever I don't remember what to do next.  I wanted to make something that I could use even if he is away.  I found similar-looking fitness projects from years past in a few pools here, including BotBarbello, which is a Slack Bot.

http://integratedinnovation.xsead.cmu.edu/gallery/projects/botbarbello-the-bodybuilder-slackbot

Process

This project built off of previous weeks' tutorials from Programming for Online Prototypes).  I reverse-engineered additional parameters for fitness information, and then used sample code provided by Daragh Byrne to work with the Giphy API.  I implemented a gem called "business_time" that I had found in an earlier discovery to keep track of the gym's hours of operation.  The files were uploaded to a local Github repository and then pushed to the cloud.

Originally, I only had the daily workouts, which combined muscle groups where applicable.  I later chose to separate the routines into their own hash in case the user wanted to look up individual muscle groups and customize their own routines.  The Giphy API, despite following a tutorial, ended up being the most frustrating part because I could see the link show up when I tested locally but I didn't see it deploying in on Heroku.  Another user ended up having the same problem, and it turned out to be related to the size of the .gif being sent, although I also had invalid url problems at first.

As with previous weeks, the user must sign up at https://pacific-scrubland-87437.herokuapp.com/about and enter their number once the secret code has been given.  There is limited interface within the website post-signup; the purpose is to have users send texts to the bot once they sign up.

Product

Files are located at https://github.com/befisher/bfisher_smsbot_2018

Available endpoints:

hi, hello, who, what, where, when, why, joke, fact, lol, haha, today, tomorrow, gym, hours, arm, biceps, triceps, back, legs, chest, cardio, arnold schwarzenegger, terry crews, picture, buff, show off, thanks

NOTE:   After clicking on the video, expand it by clicking in the upper-right corner.  Otherwise, half of the screen will be cut off.

Show Advanced Options

Reflection

I had been relying on tutorials to get each part (Twilio, Sinatra, Ruby) all communicating with each other, so when I first took out my own number or tried to get the Giphy API and business_time gem to work, I didn't understand what was going on.  It wasn't until I started really paying attention to the particular error messages and saw it work for the first time that I understood what it was asking of me, the programmer, in the first place.  Ruby is still new to me- I don't know how to use very many built-in functions or how to write code in Ruby-specific elegance.  I didn't want to touch natural language processing on this bot because it can get very complicated very quickly (sarcasm, or recognizing negatives in front of key words, etc.); as a result, the inputs are hard-coded and simplistic.  This could be improved in future iterations of the bot.

Drop files here or click to select

You can upload files of up to 20MB using this form.