WhatsApp is the best messaging app for many. Almost everyone I know uses it to keep in touch with friends and co-workers. Sometimes it’s easier to open the web client and take advantage of the real keyboard when having more in-depth conversations. I have a set of NavBar actions to make the process easier and look after your privacy better!
I’m going to borrow heavily from the NavBar part 1 as I already handled setting an active PC profile and location context. You should really take a look at the “Set active PC” and “Device Location” profiles which I’m going to use in this project.
WhatsApp NavBar Actions
To aid your conversations, I made 3 actions that are available for WhatsApp and WhatsApp for Business:
- open web client on active PC
- open web client in incognito mode (privacy mode)
- scan QR code
In the same way as before, I’m going to use EventGhost to send the active PC information back to Tasker. If you don’t have a Windows PC, or you are not able to install the EventGhost, you can still use WiFi information to set the preferred PC to open the WhatsApp web client.
This is a stand alone profile, and it will use both approaches. It will pick an active PC at home (EventGhost) and set my Laptop when I’m outside, or my work PC when I’m at work.
WhatsApp Profile
Regardless of which app are you using on your mobile (WhatsApp, WhatsApp for Business), you can use the app context to set a new NavBar. This NavBar will display the correct icon based on the %ACTIVEPC (if you want to know why this variable is set in CAPS, read this post).
The easiest way to set WhatsApp NavBar Actions is to create separate tasks which have different icons and incorporate the %ACTIVEPC in the name. This way I can simply use the value from that variable to select the correct task and assign the appropriate icon.
To handle dynamic changes between the computers, I had to update the “Set active PC” profile and add the WhatsApp entry. Each time an AutoRemote message is received, Tasker will check if WhatsApp is open and update the NavBar accordingly.
Tap #1 – WhatsApp web
Entry Exit
The fist action will be to open the WhatsApp web client in a browser. This follows the instructions from the Facebook NavBar actions. There are no changes other than the Join Push message sending “web.whatsapp.com“.
The active PC will be selected based on the current values of the %ACTIVEPC and %DEVICELOCATION. You will see the appropriate icons appear in the NavBar. The NavBar will also update dynamically as you change your computers.
Tap #2 – incognito mode
This is the first change, instead of opening the regular Chrome window, I can use EventGhost to force the “web.whatsapp.com” to open in an incognito mode. WhatsApp web in the regular Chrome window keeps you log in, so it’s possible for anyone to simply open the web client and continue the conversations on your behalf.
The incognito mode logs you out each time you close it. The downside is that you have to scan QR code each time to continue (something I will take care of using 3 taps). Unfortunately, you can only open the incognito mode using EventGhost (and even then it took me a while to figure out how).
Use the run command action and type:
start chrome --incognito "web.whatsapp.com"
This will open the incognito mode with a QR code waiting to be scanned. EventGost will respond to a simple task of sending an AutoRemote message whatsapp
. Easy enough!
I also had to add restrictions. I want the incognito to open on my Laptop when I’m not home, or send a normal (single tap) web client at work, where I can’t use EventGhost. I used %DEVICELOCATION variables to create behaviour.
Tap #3 – Scan QR code
We have the web client open, it’s time to automate the login. I’m not a big fan of AutoInput, but now, the AutoInput actions come with the ability to enable and disable the accessibility settings. Running the setting enabled creates a little lag, so having it on, just to perform a task is brilliant.
While tapping three times may be far from optimal, so I came up with one more way of getting the QR authentication automated.
Three single taps to QR
Assuming that you are in the main conversation list, to get to the QR interface it takes 3 AutoInput actions:
- AutoInput Action open “WhatsApp menu” (Enable Accessibility)
- AutoInput Action click on “WhatsApp web”
- AutoInput Action click on “scan QR” (Disable Accessibility)
I have added small delays to assure smooth operation. The most importantly remember to enable the Accessibility in the Advanced options. Since 3 of the actions are run in quick succession, don’t toggle it for each action.
QR prompt
Since the incognito mode already uses EvenGhost, I can prompt Tasker to display single tap QR NavBar instead. I used EventGhost to wait until the Chrome window is opened and then send the request via AutoRemote to display the new NavBar.
QR NavBar has only one purpose and lives for 20 sec before exiting. I found this reasonable for both QR NavBar and the 3 tap QR action. Once Tasker opens the Home screen, the context will restore the original NavBar automatically.
whatsapp=:=QR
To make this work, I need a simple profile that responds to AutoRemote event “whatsapp” and “QR” command. I don’t even have to create another Task, as long as I include %arcomm IF conditions. The QR NavBar will run only when the task is triggered via AutoRemote (%arcomm is set).
Smart NavBar integration
This is a stand-alone version of the Smart NavBar actions. Once I created the standalone versions for each NavBar Task I will show you how to integrate it together. You can read the tutorial about this now!
Conclusion
WhatsApp NavBar Actions are great enhancements to your online conversations. It shows how easy is to automate and introduce context sensitive NavBar that only shows the information you need! If you use other messengers, this could be adapted for that purpose. I’m super proud of the EventGhost variant, especially that I use more than one WhatsApp client at the time (private, work). What do you think? Share your thoughts in this Reddit thread.