Http://technologyworkroom.blogspot.sg/2013/05/tasker-how-to-read-out-whatsapp.html
Tasker can read out of incoming or stored WhatsApp Messages, I used Tasker to doing the following things on WhatsApp:
- Display the incoming messages in IOS style, no need to pulled down the notification menu to read the messages. The whole message is displayed in the menu bar. See screenshot for details
- Play different notification sounds for different contacts or different message content, this is the can for example get a Special notification If your name is mentioned.
- Mute WhatsApp at specific times or at specific locations, without muting and other notifications.
- Update: Read aloud WHATSAPP messages
What we need:
- Tasker
- WhatsApp
- Root. I want to root your phone now! You are need root for SQLite and we need it to read the database of WHATSAPP.
- SQLite for Android
- Kyo-tux Aeon HD icon Pack, provides useful icons for Tasker, its free and lightweight, so grab it
Here are the complete profiles:
Profile:whatsapp Statusbar priority:9 cooldown:0 event:notification [Owner application:whatsapp title:*]enter:wha Tsapp Notification Run Both Together a1:run Shell [command:sqlite3/data/data/com.whatsapp/databases/msgstore.db] Sele CT Timestamp,data,key_remote_jid from messages WHERE key_from_me= ' 0 ' ORDER by timestamp DESC LIMIT 1; " Timeout (Seconds): Root:on Store Result in:%sql_result Continue Task after Error:on] a2:if [%sql_result!~%sql_ Result_old] a3:variable Set [name:%sql_result_old to:%sql_result do maths:off Append:off] a4:variable Split [N Ame:%sql_result splitter:| Delete Base:on] a5:variable Set [name:%sql_result1 to:%sql_result1/1000 do maths:on Append:off] a6:variable Con Vert [Name:%sql_result1 function:seconds to Date time Store Result in:] a7:variable Split [NAME:%SQL_RESULT1 Splitt Er:delete Base:off] a8:variable Search Replace [variable:%sql_result12 search:\. Ignore Case:off Multi-line:off One Match only:offStore Matches in:replace matches:on Replace with::] A9:perform Task [name:number->name WhatsApp stop:off Priorit Y:6 Parameter 1 (%par1):%sql_result3 Parameter 2 (%par2): Return Value VARIABLE:%SQL_RESULT3] a10:wait Until [ms:0 S Econds:5 minutes:0 hours:0 DAYS:0] If [%sql_result3!~r @s.whatsapp.net] A11:array Push [name:%whatsapp_notify position:1 VALUE:%SQL_RESULT3:%sql_res ULT2 Fill Spaces:off] a12:notify Cancel [title:%whatsapp_notify4 Warn not Exist:off] a13:variable Clear [Name: %whatsapp_notify4 Pattern Matching:off] a14:notify [TITLE:%SQL_RESULT3:%sql_result2 text:%sql_result2 Icon:ipack:ky Otuxaeonhd:buddy_green number:0 Permanent:off Priority:3] A15:perform Task [name:play sound Stop:off priority:6 Parameter 1 (%par1): Parameter 2 (%p AR2): Return Value Variable:] A16:end If
The most important are A1. Here we use the installed SQLite to save the time, the sender and the content of the last message stored in the WhatsApp D Atabase into a Tasker variable. The values are separated by a ' | ', the time is in MS and the sender is stored as a phone numer. So there is some conversions needed afterwards.
You are noticed that there are a call to another tasks at line A9. WHATSAPP saves only the number of the "the" and "who" send you the message in its database, so we need to convert the number T o A real contact name as saved on your phone book. The task "Number->name WhatsApp" does it. It searches the address Book for contacts associated with a WHATSAPP account and returns their name. So after line A10 your should know who texted is the name, you can put on if clauses to react different to different names. Here the description of the "Number->name WhatsApp" task:
Number->name WhatsApp a1:run Shell [command:sqlite3/data/data/com.android.providers.contacts/databases/ Contacts2.db "Select Display_name from raw_contacts WHERE sync1 like '%par1 ';" Timeout (Seconds): 5 use Root:on Store Result in:%sql_result_name Continue Task after Error:on] a2:if [%sql_result_n Ame!~r Sql_result_name] A3:return [value:%sql_result_name stop:on] a4:else a5:return [value:%par1 Stop : On] a6:end If
At line A15 of the task ' WhatsApp Notification ' task I call a Tasker task called ' Play Sound '. That's because I disabled notification sounds in WhatsApp to handle them myself (they is time and WhatsApp message Conten T depandant). Here's example of how a simple ' Play sound ' task could look like:
Play Sound Run Both Together a1:if [%par1 ~r. *[rr]+[uu]+[aa]+[rr]+.*] a2:variable Set [name:%tmp to:%vols do Ma Ths:off Append:off] a3:wait [ms:50 seconds:0 minutes:0 hours:0 DAYS:0] A4:system Volume [Level:7 display:off Sound:off] a5:if [%silent ~ Off] A6:play Ringtone [type:notification Sound:dinosaur Roar stream:1] A7:else If [%headset ~ 1] a8:play Ringtone [type:notification sound:dinosaur Roar stream:1] a9:end If a10:vibrate [time:1000] a11:vibrate [time:1000] a12:vibrate [time:1000] a13:vibrate [time:1000] a14:wait [ms:0 Seconds:5 minutes:0 hours:0 DAYS:0] A15:system Volume [level:%tmp display:off Sound:off] A16:else If [%par1 ~r [mm][ii][aa][uu]+\b] a17:if [%SILEN T ~ off] a18:play Ringtone [type:notification sound:miau stream:1] A19:else If [%headset ~ 1] A20:pla Y Ringtone [type:notification sound:miau stream:1] a21:end If a22:else a23:if [%par2!~ 1] a24:if [%headset!~ 1] a25:if [%silent ~ off] a26:vibrate [time:100] A27:pla Y Ringtone [type:notification sound:good news stream:5] A28:end if a29:end if A30:end if A31:end if
If headphones is connected or phone is on the silent mode no sound was played at all. If The message contains something like "rrruaaarrrr" a dinosaur roar was played at full volume (even with headphones Connec Ted) and the phone vibrates for 4 seconds. If a "miauuu" is in the message a cats Miau is played ... I ' m sure can do better:)
You can even make Tasker react on a click on one of the notifications and just add the following profile:
Profile:whatsapp Notification1 Click event:notification Click [Owner application:tasker title:%whatsapp_notify1]Enter : Open WhatsApp a1:load App [App:whatsapp data:exclude from recent Apps:off]
Duplicate this profile The times so you can click on any of our three custom notifications.
Profile:whatsapp Notification2 Click event:notification Click [Owner application:tasker title:%whatsapp_notify2]Enter : Open WhatsApp a1:load App [App:whatsapp data:exclude from recent Apps:off]profile:whatsapp Notification3 Click even T:notification Click [Owner application:tasker title:%whatsapp_notify3]enter:open WHATSAPP a1:load App [App:whatsapp Data:exclude from recent Apps:off]
I added another profile which deletes all our custom made WhatsApp notifications automatically after opening WhatsApp. Looks like this:
Profile:whatsapp opened Application:WhatsAppEnter:WhatsApp Notification clear a1:notify Cancel [title:%whatsapp_notif Y1 Warn not Exist:off] a2:notify Cancel [title:%whatsapp_notify2 Warn not Exist:off] a3:notify Cancel [Title:%whatsa Pp_notify3 Warn not Exist:off] a4:variable Clear [name:%whatsapp_notify* Pattern Matching:on] a5:stop [with Error:of F Task:whatsapp Notification]
The knowledge wisely. Please leave your thoughts in the comments, I ' m very excited about your implementations. Hope you read this Ruy Aguilar;)
Cv
How to read out WHATSAPP messages with Tasker and react on their content in real time