Pound For Pound, Text for Text: FitMeal Tracks Your Calories via Twilio SMS

November 23, 2015
Written by

FitMealFeatured

The culmination of Georges Duverger’s quest to lose weight took place on Vice’s Snapchat feed.

Georges gained weight the way many tech employees gain weight. He was working long, stressful hours and traditionally went for the easiest food option, which is rarely the healthiest option. After doing this for years, he decided he needed to find a way to lose weight using a tool he knew well – code. A few years later, FitMeal was born, and featured on Vice.

fitmeal
FitMeal lets you record what you eat via SMS, and texts you back nutritional information about your meal – calories, grams of fat etc.  Vice puts what FitMeal does quite simply in their headline “Text This Number To See How Unhealthy Your Lunch Was”. When Georges noticed a massive uptick in registrations he thought it was from the article. But when he checked his Twilio SMS logs, he realized that wasn’t the case.

In his logs Georges saw a text along the lines of “saw you on Vice’s snapchat!” He replied to the user directly. But that process wasn’t scalable as users kept rolling in. Eventually he had to build a waitlist for FitMeal. The validation felt like it was a long time coming for Georges.

Here’s what the Vice-induced traffic spike looked like in Georges’ Twilio logs.

fitmeal-twilio

 

FitMeal was built using Python, deployed on Heroku and uses a Django Database. But, it started on pen and paper. When Georges was looking for a good way to track his eating habits he struggled to find something that was both easy to use, and private. He tried posting his meals to a private blog, but he had to remember to do that after each meal, and often missed a few. Texting seemed like the easiest and most reasonable medium for Georges.

“I can do it in 30 seconds, with no hands. I just tell Siri what to text my Twilio number,” says Georges. “Naturally, I ended up with SMS because it’s the simplest entry method.”

For Georges, the initial success of FitMeal pays off in double. He lost the weight, and he found success with a product he built himself. The sensation of personal and professional success is not lost upon him, but he prefers to keep it professional.

“After a few experiments, I found something that resonates with people. That feels good.”

Here’s a little portion of George’s code that shows how FitMeal replies with the calorie count of your meal.
 

def reply(request):
"""
Reply to a text message with nutrition facts (edited snippet)
"""
args = {}
if request.method == 'POST':
# Get the text message
text = request.POST.get('text')
# Find the food
features = app_process.extract_features(text)
# Find the nutrition facts
nutrients = app_process.compute_nutrients(features)
# Write the response
response = app_process.compose_response(nutrients)
if response:
args.update({'response': response})
else:
logger.error(text)
return render_to_response('reply.xml', args, context_instance=RequestContext(request), content_type='application/xml')

 

Learn more about FitMeal here.