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

Open on Desktop

Open on Laptop

Cast based on Device Location

Scan QR code to log in

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

TASKER PROFILE: NB WhatsApp Profile: NB WhatsApp Application: WhatsApp or WA Business Enter: NB Whatsapp ( A1: Variable Set [ Name:%NBactiveApp To:WhatsApp ] If [ %arcomm !Set ] A2: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right:task(NB WhatsApp %ACTIVEPC=:=NB WhatsApp DT %ACTIVEPC=:=NB WhatsApp Login)[1.0] ] If [ %arcomm !Set & %DEVICELOCATION ~ home ] A3: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right:task(NB WhatsApp WIFI=:=NB WhatsApp DT Laptop=:=NB WhatsApp Login)[1.0] ] If [ %arcomm !Set & %DEVICELOCATION !~ home ] A4: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right:task(NB WhatsApp Login)[1.0] ] If [ %arcomm ~ QR & %NBactiveApp ~ WhatsApp ] Exit: NB W Reset (54) A1: Variable Set [ Name:%NBactiveApp To:none ] A2: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right: ]

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.

TASKER PROFILE: Set Active PC Profile: Set Active PC Event: AutoRemote [ Configuration:activePC (regex) ] Enter: Set ACTIVEPC A1: Variable Set [ Name:%ACTIVEPC To:%arcomm ] ... A5: If [ %NBactiveApp ~ WhatsApp & %DEVICELOCATION ~ home ] A6: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right:task(NB WhatsApp %ACTIVEPC=:=NB WhatsApp DT %ACTIVEPC=:=NB WhatsApp Login)[1.0] ] A7: End If

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“.

TASKER TASK: WhatsApp Laptop NB WhatsApp Laptop A1: Join Send Push [ Configuration:Url: https://web.whatsapp.com/ Device Name: %ACTIVEPC Timeout (Seconds):60 ] A2: Flash [ Text:Sent to %ACTIVEPC Long:Off ]

TASKER TASK: WhatsApp Desktop NB WhatsApp Desktop A1: Join Send Push [ Configuration:Url: https://web.whatsapp.com/ Device Name: %ACTIVEPC Timeout (Seconds):60 ] A2: Flash [ Text:Sent to %ACTIVEPC Long:Off ]

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.

TASKER TASK: WhatsApp WIFI NB WhatsApp WIFI ( A1: Join Send Push [ Configuration:Device: Laptop Url: https://web.whatsapp.com/ Timeout (Seconds):60 ] If [ %DEVICELOCATION ~ elsewhere ] A2: Join Send Push [ Configuration:Device: Work Url: https://web.whatsapp.com/ Timeout (Seconds):60 ] If [ %DEVICELOCATION ~ work ] A3: Flash [ Text:Done Long:Off ]

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.





TASKER TASK: WhatsApp DT Laptop NB WhatsApp DT Laptop Abort Existing Task A1: Join Send Push [ Configuration:Device: Work Url: https://web.whatsapp.com/ Timeout (Seconds):60 ] If [ %DEVICELOCATION ~ work ] A2: AutoRemote Message [ Configuration:Recipient: %ACTIVEPC Message: whatsapp Timeout (Seconds):200 ] If [ %DEVICELOCATION !~ work ]

TASKER TASK: WhatsApp DT Desktop NB WhatsApp DT Desktop Abort Existing Task A1: AutoRemote Message [ Configuration:Recipient: %ACTIVEPC Message: whatsapp Timeout (Seconds):10 ]

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 )

TASKER TASK: WhatsApp Login NB WhatsApp Login A1: AutoInput Action [ Configuration:Type: Text Value: More options Action : Click Manage Accessibility Service: Enable Before Action Timeout (Seconds):23 ] A2: Wait [ MS:457 Seconds:0 Minutes:0 Hours:0 Days:0 ] A3: AutoInput Action [ Configuration:Type: Text Value: WhatsApp Web Action : Click Timeout (Seconds):23 ] A4: Wait [ MS:367 Seconds:0 Minutes:0 Hours:0 Days:0 ] A5: AutoInput Action [ Configuration:Type: Text Value: Scan QR code Action : Click Manage Accessibility Service: Disable After Action Timeout (Seconds):23 ] A6: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ] A7: Go Home [ Page:0 ]

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.

Entry

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.