Monthly Archives: June 2015

Collecting Wedding Photos with Twilio MMS

Last Saturday I got married to my longtime pal Emily. Emily handled a lot of the wedding planning and she did a really great job. I wanted to do some fun things for the wedding and reception and thought it would be fun to make a way for friends to share their photos of our day with us.

I was thinking that it would be easy enough to give people an Instagram hashtag and be done with it, but I wanted to make sure all (or at least most) of our guests would be able to participate. I figured that Twilio’s MMS would be a pretty straightforward way for our guests to share photos throughout the day without having to remember a hashtag or use a specific app.

I set up a Twilio phone number to receive and send text messages. Actually, I just re-used an old one that I still had enabled since I used it for voice only. Because I wanted to write as little boilerplate as possible, I decided on using the Django web framework which I’m already really familiar with. The Django admin panel was incredibly useful for debugging and made it dead simple to view photos that were sent. I used the django-twilio library which also uses the twilio-python library. I’ve been on a Heroku app hosting streak lately so I made sure the app could be easily deployable on Heroku for free.

Since I didn’t have a whole lot of time to build this app (wedding planning takes a lot of attention), I limited my scope to a few goals:

  1. Be able to broadcast messages to guests throughout the day.
  2. Accept messages that contain MMS images (one or more) and save them to a database.
  3. Allow guests to “unsubscribe” to messages in case they didn’t want them.

I ended up using Ngrok to test the app locally, then threw Runscope in front of it for good measure (yo dawg, I heard you like proxies). Runscope was pretty useful in that I didn’t have to keep sending test SMS and MMS messages to my app; I could just replay ones that I had sent previously. It probably saved me ~$1 in fees!

It was pretty straightforward to implement all three of these using the Django library I mentioned earlier. Because all Twilio text messages hit just one endpoint, I had to design around different use cases which made my code a bit messy. It was fine for an app I’m only going to use once, though. The code is gross but it worked and I’m glad I didn’t make it more complicated than it needed to be. I was originally going to use the broadcasting feature more than I ended up using it (I wanted to do something like cat facts) which added a bit to the codebase.

As far as final statistics, I received 70 images from guests during and after the event. Some of them are pretty awesome. In case anyone is interested in how the app works/worked, I posted the source code with my hardcoded phone numbers removed and turned into environmental variables. You can check it out here.

I am not posting any photos that my guests sent here since they were meant to be private, but here’s a photo I took with my selfie stick of us and the cake!

Cake Selfie