Little hacks: SMS YouTube

marcel corso
MessageBird
2 min readJun 2, 2016

--

I thought of creating something silly and fun for our last IPAs & APIs meetup in our Amsterdam office — so that people could easily play YouTube videos and listen to music together (YouTube parteeey Yeeey!). That’s why I made this hack real quick, where you can SMS a video title to a mobile number and it will immediately start playing on the screen.

Try it yourself!

– Go to smsyoutube.herokuapp.com
– Send an SMS with ‘Never gonna give you up’ to +447860039713
– RickRoll’d!

Nothing to download, no need to connect to a wifi network, everyone can just join in on the fun. If you feel lucky you can even send a random keyphrase or keyword and see what happens. Play random YouTube Roulette, with people you’ve just met 🙂

How does it work?

First, we register a Virtual Mobile Number (VMN) and configure it in my MessageBird account to do a POST to a URL on every message. I used a UK VMN as that works with most international mobile numbers. At the end of that URL there is a small piece of Go code I mashed up and hosted on Heroku. That piece of code does a search on YouTube an inserts the result, a video ID, into a Firebase list.

On the other end, on that very cool html page there is a javascript code that watches that Firebase list. When there is a new entry it tells the youtube embed, via the YouTube iframe API, to bluntly switch to that video. Want to play around with it yourself? It’s on GitHub, have fun!

--

--