Montag, 26. Januar 2015

Push2WhatsApp

Compose your messages on any device (Mac, Windows, Linux, iPad) and push it to WhatsApp on any smartphone (iPhone, Android) in a flash.

If I earlier wanted to send a longer message with WhatsApp, I have written it on my Mac or PC, then emailed it to myself, opened the email on my smartphone, got the message copied to the clipboard, pasted it to WhatsApp and finally sent it. No fun. That's why I was disappointed when I heard that the new WhatsApp Web still doesn't support Mac and iPhone. Looking for alternatives I played a bit with PushBullet. With PB you can create a message on any device and send it to your smartphone. That's nice but it still requires the clipboard detour.

The Solution: PushBullet with WhatsApp's URL scheme 

A link sent with PushBullet normally opens in the browser of the target device. But if the link is a URL scheme it can open almost any app.
WhatsApp comes with a URL scheme that allows to pass text, even to a specific contact.

whatsapp://send?text=Hello%2C%20World!

If you send this as link PushBullet opens WhatsApp on the target device. After selecting a contact it starts a new chat session with the sent text "Hello World!".
If you know the Address book ID of the contact you can even start the chat directly:

whatsapp://send?abid=1234&text=Hello%2C%20World!

However, this solution has a drawback: the text has to be url-encoded. As a URI supports only ASCII, many letters like linefeeds, spaces, German umlauts would not be transmitted.

HTML form with JavaScript

To simplify the workflow I wrote a HTML-form with some lines of JavaScript. The only requirement to make it work is your PushBullet Access Token. This has to be inserted into the script:



You can also provide the WhatsApp ABIDs of your favorite contacts to make the workflow even smoother.

The script uses the PushBullet API to retrieve a list of your connected devices and to push the message to WhatsApp.
The script runs locally on every browser. If you upload it to a web space you can push your messages from any device. No need to install any software.

By the way: you can also use URL schemes sent with PushBullet to automate other workflows on your devices. I use a modified script with Drafts, Pythonista, Launch Center, Workflow, Texttool etc.

Short demo on Youtube

Download HTML form from Dropbox
The script is freeware. Any liability and warranty excluded.