How to push GMail, Twitter to your iPhone with Prowl
July 25, 2009 – 1:26 amOfficially, Prowl is described as a ‘Growl client for the iPhone’, which doesn’t mean much to most non-Mac users. Here’s an alternative description: Prowl lets you send push notifications to your iPhone. Unlike most programs that use push, Prowl doesn’t use it for a specific purpose; You can send any notification you like using their API. I’m currently using Prowl and some Perl scripts to push new GMail messages and Twitter mentions. In this post I’ll explain how to create such a setup, but you’ll probably need some Perl skills to make it work with my scripts. It’s also easy to add other types of notifications.
I should mention first that there are simpler alternatives. You can use Growl to push GMail, Twitter, and lots of other stuff (see their apps page). The latest version supports true GMail push using IMAP IDLE. YMMV but when I tried it Growl was unreliable and constantly lost notifications. There are also iPhone apps that push specific types of notifications; For instance Boxcar pushes Twitter mentions and DMs. Those seem to me like a waste of money (with one small caveat — below) since Prowl can handle that and more. Also, when using Prowl it is your own computer that handles the notifications, so you don’t need to give anyone your GMail or Twitter password.
The only disadvantage to using Prowl is that the ‘Slide to View’ function on the iPhone takes you to Prowl instead of to the relevant app. For example, with Boxcar, ‘Slide to View’ takes you to your Twitter client. In my experience this is a non-issue.
Finally, the instructions and scripts below are provided AS IS and without any warranty. The scripts are licensed under the Perl license.
The Setup
Here is what you’ll need:
- An iPhone running 3.0 or higher with push notifications enabled
- A computer that is connected to the internet 24/7, which will run the notification scripts
- Perl installed on said computer (this is needed if you want to use my scripts)
Install Prowl on your iPhone (it costs $3) and register an account. Login on their site and go to the settings page. Click ‘Generate API key’ and save the API key to a file. This key is like a password you use for sending yourself notifications.
If you want push GMail, enable IMAP access to your GMail account.
Next, to run my scripts you’ll need some Perl modules that you can get from CPAN. They are:
FindBinList::UtilData::DumperWebService::ProwlNet::IMAP(for GMail notifications)Net::Twitter(for Twitter notifications)
Download the scripts and insert your details:
- Place your Prowl API key that you created above in
prowl_apikey - Enter your GMail username and password in
push_gmail.pl - Enter your Twitter username and password in
push_twitter.pl
Run push_gmail.pl to get GMail notifications. Run push_twitter.pl to get Twitter notifications.
How It Works
Push GMail works using the IMAP IDLE command, which lets a client leave a connection open to the server, and when a new message comes in the server notifies the client. I used the
Net::IMAP package, which sadly didn’t support IDLE. So I added this support in a very inelegant way — you can find it in Client.pm, which is a modified version of the original Net/IMAP/Client.pm the comes with Net::IMAP.
Push Twitter is more straightforward and works by simply polling Twitter every minute, using their API.
Subscribe by email
2 Responses to “How to push GMail, Twitter to your iPhone with Prowl”
Very cool. Thanks for the patch of Net::IMAP::Client, although inelegant. Maybe you want to submit the patch to the original author?
By Stephan on Aug 6, 2009
Yes, I guess it’s the right thing to do, even though it’s a bit embarrassing.
By Anonymous on Aug 11, 2009