Hubot for Smartphone Messaging

存储架构 2015-01-18

18 January 2015

is a fantastic chat bot for automating parts of your life. It’s widely used by developer teams, but I wanted to run an instance when exchanging messages with my friends and family. I tested several chat apps, and eventually got Hubot working with Telegram. Here’s what I’ve learnt about running Hubot with smartphone messaging.


In my social circles, WhatsApp
is the clear winner by usage. To my disappointment, there’s no official API available for WhatsApp.

In spite of this, there’s OpenWhatsApp
and WhatsAPI
. WhatsApp is basically a modified XMPP protocol, and intrepid open source developers have reverse-engineered it.

However, WhatsApp has a history of raising legal objections ( 2012
, 2014
) to third-party implementations. Whilst I believe this is entirely legal in the UK, I wasn’t interested in writing code that could result in legal threats. To make matters worse, if WhatsApp don’t support an official API, they could in principle change it at any moment.


I started by looking at popular alternatives to WhatsApp, so I decided to try Kik
. Kik provides a great client on both Android and iOS with all the group chat features we’ve come to expect from WhatsApp.

Kik has usernames, rather than finding people through phone numbers, but account creation is very lightweight.

Kik does provide an API
. However, it’s entirely targeted at developers building webapps within their client. Whilst there exist spam bots on the Kik platform
there doesn’t seem to be an API for building your own chat bots. This is ironic when all new Kik users get the official Kik bot added as a default contact.

Jabber / XMPP

After two failures with proprietary services, I tried setting up Jabber instead. This is can be labour intensive.

I installed the excellent ejabberd
on a personal server. Ubuntu’s packages work out of the box, but they’re v2.1.10, which dates from late 2011.

Jabber is an extremely extensible protocol: most of the features you will want are optional extras. As a result, you need to ensure your server and clients all support the XMPP extensions
you plan to use. This can be tricky: it’s not always clear which extensions different clients and servers support. I was also caught out by some extensions which require no support from the server at all, just client support.

Finding good smartphone Jabber clients was harder than setting up a server, especially when you require group chat (called ‘conferences’ in XMPP). For Android, Conversations
is excellent. For iOS, I never found a good client that supported group chat and push notifications. It turns out this is almost impossible to implement on iOS

Jabber is a chat protocol designed for computers, not smartphones. Jabber has poor support for contact discovery (WhatsApp just uses phone numbers) and fairly long usernames. Its support for sharing images is weak, requiring both clients to be online at the same time. The general Jabber design seems to be centred around users logging in, chatting, then logging out. A smartphone-centric design is different: I expect to be always connected, receive push notifications, and for my client to sync when I’ve been out of service.

If I were looking for a chat protocol for a team sitting in front of laptops, I would seriously look at Jabber. As a WhatsApp alternative, I don’t think it’s suitable today.


Telegram is another popular WhatsApp alternative, but includes a documented, open API
. There are established open source implementations, and even the official clients are open source!

The Telegram clients on Android and iOS are both excellent, providing almost exactly the same functionality of WhatsApp.

Setting up a Hubot instance is a little time-consuming, but works very well. There’s a Hubot adapter for Telegram
and I’ve written a step-by-step setup guide
. You will need a fresh telephone number for your bot ( Twilio
is ideal for this), the latest version of tg
and then you can configure your Hubot as normal.

Final Thoughts

Smartphone messaging has yet to consolidate: there are many competing protocols
with no clear winners yet. Protocols tend to compete on availability of clients (Android/iOS/Windows Phone/Blackberry/web) and featureset, so API availability is not a differentiating factor. However, hackable protocols will grow a larger ecosystem, which is a great help when developing a new chat app.

So, I’d recommend Telegram today. If you’re using chat bots on your smartphone, I’d love to hear from you.

Once you’re up and running, the whole Hubot ecosystem is available to you. There are ~800 Hubot packages on npm
and ~450 scripts included in hubot-scripts
. Hubot is easy to extend if there’s something missing. Give it a try!

责编内容by:Wilfred Hughes Blog (源链)。感谢您的支持!


10x Faster Today but 10x Harder to Maintain Tomorr... I’ve been digging into what it means to be a site reliability engineer (SRE) an...
Wireline SerDes系列(三):UCLA HSEL的独门兵器RFI... 作者:@李一雷 我们在之前的两篇文章里介绍了Wireline SerDes的基本概况(见 为什么最近Wireline SerDes这么火 ...
Let’s make it simple for you and your chatbot You must have heard a lot about chatbots already. Maybe you read this article i...
BIG-IP Upgrades Part 1 – Preparation The information is this series is meant to help a Big-IP administrator complete ...
Gap Buffers Are Not Optimized for Multiple Cursors Gap buffers are a common data structure for representing a text buffer in a text...