What is @whensmybus?
@whensmybus is a Twitter bot that tells you what time London buses are arriving at a stop near you, based on your location and TfL’s real-time data.
Awesome. How do I get bus times?
The easiest way is, if you have GPS-enabled smartphone like an iPhone or Android phone. Just make sure you have your current location added to your Tweet - instructions on doing so are here. Then just Tweet your bus number to @whensmybus, e.g.:
If you don’t have a GPS-enabled smartphone, or prefer not to disclose your location, then you can include “from [placename]” where, [placename] is where you want to go from, e.g.:
@whensmybus 135 from Canary Wharf
You can also use the SMS code provided on the stop by TfL, e.g.:
@whensmybus 135 from 74754
Either way, @whensmybus will work out where you are. Within a minute it will Tweet back at you the latest bus times for up to two of the next two buses from each of the stops nearest to you, e.g.:
@qwghlm 135 Canary Wharf Station to Old Street Stn 1144 1157; Canary Wharf Station to Crossharbour 1139 1153
Note that it will only give two bus times if there are two buses are shown on the system; there’ll be times where there might be only one bus due, in which case you’ll only get one time.
What’s better, GPS or non-GPS?
The GPS version, it’s sexier. Seriously, it will be more accurate - there’s always a chance you’ll spell the placename wrong, or it will be ambiguous. @whensmybus will try its best to find the most appropriate departure point for your route, but geocoding is hard and it may not work 100%, especially if you’re asking for something vague like “High Street”.
Isn’t this pointless? Don’t TfL offer the same information as well?
TfL do offer the same information, on the web (for free), or via SMS (for which they charge the network rate + 12p per text). But I found the mobile web experience a bit fiddly, and thought a lightweight Twitter solution, using its geolocation and realtime features, was a nice alternative.
I’d like to use @whensmybus but I don’t like giving away my location. Can I send it a direct message instead?
Yep, you can send Direct Messages to @whensmybus as well. You first need to follow it, then it will auto-follow you back within a few minutes. Once you’re both following each other, you can send it a Direct Message. However, you cannot add your GPS position to a Direct Message (Twitter’s rules, not mine), so you have to specify your departure point in your Tweet, e.g.:
d whensmybus 135 from Canary Wharf
Can I specify more than one bus at once?
Yes, you can, up to three different bus routes. Just separate them with spaces e.g.:
@whensmybus 135 277 D7
And of course it works with placenames too:
@whensmybus 135 277 D7 from Canary Wharf
They don’t have to all stop at the same stop, so if you have two different buses to the same destination, but arriving on different stops, you can use this to work out which one comes first!
I’ve added location to my Tweets but it’s not working!
This can be a point of confusion: Twitter offers the option to add a default “Place” to every Tweet you make (e.g. “Westminster, London”) via the website or via desktop apps such as Tweetdeck. However these Places are not your exact GPS location and they are too vague for @whensmybus to work out exactly where you are; for example, “Westminster, London” covers virtually all of Travelcard Zone 1.
This Place info (via the web, or on a desktop app) is not to be confused with adding your exact location via GPS (on your mobile). At the moment, Twitter doesn’t allow you to provide detailed GPS-quality location information from the Twitter website or desktop apps, alas.
I want to ask it several times during the day, but Twitter doesn’t like me making duplicate Tweets
Put a random hashtag at the end of your Tweet after the route number to make it unique; the bot will ignore all hashtags and let you ask for the same bus multiple times.
Who are you, and why did you create this bot?
I’m Chris Applegate, and I’m a hacker and transport geek based in London. I work for We Are Social in the day job, but this bot was built in my spare time, and I initially did it because it was fun. Since then, I’ve been stranded when cold and drunk at a bus stop and realised it’s actually quite, quite useful.
How did you build this? Is the source code available?
I built this with TfL’s data API, co-ordinate conversion code from Chris Veness and the help of the Tweepy library. Geocoding of placenames is done by the Yahoo Placefinder API. The source code is available on github.