Re: Can Tasker read instant messages out loud?

3,725 views
Skip to first unread message

Roberto Cocchiararo

unread,
May 20, 2013, 11:08:33 PM5/20/13
to tas...@googlegroups.com
with google talk yyou could just read the notification TITLE (%NTITLE i believe) and it would read "SENDER said MESAGE"or something like that.

with hangouts if you have more than 0 unread mesages, it just says "n unread messages":(

On Monday, May 20, 2013 2:34:25 PM UTC-3, doc1987 wrote:
I use Tasker to read SMS's when I am driving using the %SMSRN and %SMSRB. And I was wondering if there is a way to get Tasker to read IM's from Google's new Hangouts app in the same manor as it does SMS messages? I think it would require the use of a custom made variable, but I am still a newbie when it comes to Tasker and using custom made variables. Thank you.

doc1987

unread,
May 20, 2013, 11:35:48 PM5/20/13
to tas...@googlegroups.com
I am pretty sure the answer to this question is no, but can tasker mark hangout messages as read? And I also have a profile setup to auto reply to texts that I am driving and will respond when I safely can.

If
%T_PREVIOUS_SMS !~ %SMSRF
Variable Set: Name; %T_PREVIOUS_SMS To; %SMSRF
Send SMS: Number; %SMSRF
Notify: Title; SMS Auto-reply
End IF
Variable clear: Name; %T_PREVIOUS_SMS

Is there a way to do the above with incoming IM's from Hangouts?

bdanders

unread,
May 21, 2013, 9:06:27 AM5/21/13
to tas...@googlegroups.com
You can get the content of a Hangouts message by storing the contents of %NTITLE in a variable upon receipt of a Hangouts notification. It's been working fine for me anyway.
Message has been deleted

doc1987

unread,
May 21, 2013, 9:26:18 AM5/21/13
to tas...@googlegroups.com
That is something about variables that confuses me. How would I go about storing the contents of %NTITLE in a variable? And would it allow me to send an automated message back to the sender? Would it also clear the notification, or read each new notification no matter how many I have received?

bdanders

unread,
May 21, 2013, 9:34:34 AM5/21/13
to tas...@googlegroups.com
You store the contents of %NTITLE by using the "Variable Set" task and putting %NTITLE in the "To" field. You can send an automated message, but it is a pretty advanced process using SL4A scripting. I don't know of any way to clear the notification.

doc1987

unread,
May 21, 2013, 9:41:48 AM5/21/13
to tas...@googlegroups.com
I have no experience doing any SL4A scripting. Would you be able to help me with that or is there a good detailed website that can explain it well for a beginner? And thank you for the help.

TomL

unread,
May 21, 2013, 9:48:53 AM5/21/13
to tas...@googlegroups.com
You can try reading this:


Just a warning, I think one would need to have some experience Android shell scripting and some basic Java knowledge in order to start using SL4A.

Tom

doc1987

unread,
May 21, 2013, 9:54:26 AM5/21/13
to tas...@googlegroups.com
Thank you Tom. Do you think someone might create a plugin for Hangouts, or possibly an update to Tasker once they incorporate SMS into Hangouts to be able to do stuff like this with Hangouts?

TomL

unread,
May 21, 2013, 10:02:58 AM5/21/13
to tas...@googlegroups.com
Dunno.  An alternative is to research online and see if the Hangouts app allows other apps (like Tasker) to send commands (called "intents") to Hangouts.  Basically, you need to google for something like:

does Google Hangouts support intents from third party apps?

If so, then once you get the details for the intent syntax, you can have Tasker send those intents to Hangouts.

Tom

bdanders

unread,
May 21, 2013, 10:34:15 AM5/21/13
to tas...@googlegroups.com
This thread should help you get started if you want to send IM via SL4A and Tasker.
https://groups.google.com/d/topic/tasker/IJPIMLaNFl0/discussion


On Tuesday, May 21, 2013 9:41:48 AM UTC-4, doc1987 wrote:

Roberto Cocchiararo

unread,
May 21, 2013, 6:38:12 PM5/21/13
to tas...@googlegroups.com
I once again want to remind you that unless you can clear the notification and/or mark messages as read, this wont do you much good. I have currently disabled my task for this app.

Mefistofelis

unread,
May 22, 2013, 9:45:04 AM5/22/13
to tas...@googlegroups.com
Just to share one of my setups, use it to isolate and Flash the latest whatsapp message ( its a modification from an existing thread):

Make a profile - notification received- and choose the app whatsapp.

Then create s task:
1. Run shell and on command enter the FOLLOWING : conv=`/system/xbin/sqlite3 /data/data/com.whatsapp/databases/msgstore.db "SELECT key_remote_jid FROM messages WHERE key_from_me='0' ORDER BY _id DESC LIMIT 1;"`; echo -e `/system/xbin/sqlite3 /data/data/com.whatsapp/databases/msgstore.db "SELECT key_from_me,data,media_mime_type FROM messages WHERE key_remote_jid='$conv' ORDER BY _id DESC LIMIT 1;"` | sed -e 's/0|/\nMe: /g' -e 's/1|/\nContact:/g' -e 's/|//g' | tac;

Then in store output in enter %Whatsapp

2. Variable split - in name of variable enter %Whatsapp and as splitter enter ":" without the quotes

3. And then you can flash the variable %Whatsapp2 to see if it worked.

You must enable accessibility service for tasker in order for it to work.

I use this profile to hear my messages when I drive, that it's when my auto bt is connected. moreover it's very practical to get every message flashed if you are doing something else instead of having this annoying pop-up. If you find more creative uses please share!

Enjoy

doc1987

unread,
May 22, 2013, 10:02:37 AM5/22/13
to tas...@googlegroups.com
Do you have to use Whatsapp with this setup? I would prefer to use Hangouts instead of third party app like whatsapp.

Mefistofelis

unread,
May 22, 2013, 10:08:32 AM5/22/13
to tas...@googlegroups.com
yes, i am afraid this one is custom tailored for whattsapp

doc1987

unread,
May 22, 2013, 10:11:07 AM5/22/13
to tas...@googlegroups.com
Do you know of a way other than using SL4A scripting to be able to send a auto response to IM's while I am driving?

doc1987

unread,
May 22, 2013, 10:12:40 AM5/22/13
to tas...@googlegroups.com
Roberto, why not in the task that reads the IM's just put a wait 1 sec; load app Hangouts; wait 1 sec; kill app Hangouts; to clear the notification?

bdanders

unread,
May 22, 2013, 4:58:56 PM5/22/13
to tas...@googlegroups.com
There is a sql database with all the messages that should let you get just about any information you need with the right shell command. To get the last message (sent or received) try:

sqlite3 /data/data/com.google.android.talk/databases/babel0.db 'SELECT text FROM messages ORDER BY _id DESC LIMIT 1'

I have two different database files in that directory, babel0.db and babel1.db that seem to be for the 2 different accounts on my phone. You probably need to verify the file name before trying this command.

You should be able to run that on every Hangouts notification, use the result to populate an array, then have a separate profile that reads the contents of the array, popping the values back out as you go along. Works in theory anyway.

doc1987

unread,
May 23, 2013, 10:50:15 AM5/23/13
to tas...@googlegroups.com
Does sqlite3 /data/data/com.google.android.talk/databases/babel0.db 'SELECT text FROM messages ORDER BY _id DESC LIMIT 1' go into the command line on the "run shell" task in tasker? or is there a different task i need to be using?

bdanders

unread,
May 23, 2013, 1:14:50 PM5/23/13
to tas...@googlegroups.com
I guess I should also have mentioned that this method will likely require root access. Run that command (with root) in a Run Shell action and store output in whatever variable you choose. I've actually updated my command to include the sender and the message in the same output, separated by ":|:"

last_message=`sqlite3 /data/data/com.google.android.talk/databases/babel0.db 'SELECT text FROM messages ORDER BY _id DESC LIMIT 1'`
sender=`sqlite3 /data/data/com.google.android.talk/databases/babel0.db 'SELECT full_name FROM participants WHERE gaia_id LIKE (SELECT author_gaia_id from messages ORDER BY _id DESC LIMIT 1) ORDER BY _id DESC LIMIT 1'`
echo $sender":|:"$last_message

doc1987

unread,
May 23, 2013, 1:30:10 PM5/23/13
to tas...@googlegroups.com
So you have one Run Shell command with both those sqlite3 commands correct? How do you have that setup exactly? What fields in what tasks are what values?

bdanders

unread,
May 23, 2013, 2:43:29 PM5/23/13
to tas...@googlegroups.com
Yes, it's a single run shell action. You're going to have to ask more specific questions than that though. Have you even tried it yourself yet?

doc1987

unread,
May 23, 2013, 3:24:58 PM5/23/13
to tas...@googlegroups.com
I have gotten to work with 2 different Run Shell tasks. One for the grabbing the sender and one for grabbing the message and that works just fine. I am not sure how to get it to output both the sender and the message to 2 different variables within one run shell task? I just am clueless how to format the Run shell task for that.

bdanders

unread,
May 23, 2013, 4:51:12 PM5/23/13
to tas...@googlegroups.com
The output of the last command I posted should be of the form "sender:|:message" which you can then use as is or format in tasker using the split action. Or you could format the shell command to something along the lines of

echo "Message from"$sender":"$last_message

doc1987

unread,
May 23, 2013, 5:03:06 PM5/23/13
to tas...@googlegroups.com
OK, I see how that works now. Thanks so much for the help. Now all I need to do is figure out how to use the 'Script to send a gTalk message' to send an automated reply to people while I am driving.

bdanders

unread,
May 24, 2013, 8:48:22 AM5/24/13
to tas...@googlegroups.com
I'm not sure how hard I would work on that if I were you. It sounds like that functionality might be going away with the transition to Hangouts and the abandonment of xmpp/jabber. Some people are already reporting that it has stopped working, although it's still working for me.

doc1987

unread,
May 24, 2013, 9:34:00 AM5/24/13
to tas...@googlegroups.com
So I am guessing that no one has come up with a possible work around solution yet?

Roberto Cocchiararo

unread,
May 25, 2013, 4:21:14 PM5/25/13
to tas...@googlegroups.com
Any idea/insight into how to disern to wich account the message came to ? i have 4 accounts, altough i only chat on 2. (for selecting which database to read, even if it means having 2 profiles or something)

bdanders

unread,
May 28, 2013, 8:50:37 AM5/28/13
to tas...@googlegroups.com
I guess you could grab the latest message from each database and compare them to the notification title if it's available to see which account it went to.

Roberto Cocchiararo

unread,
May 28, 2013, 6:31:23 PM5/28/13
to tas...@googlegroups.com
That would not work, primarily beacause when you get 2 without reading them, it just notifies the number of unread notifications.

If that had not changed form gtalk, i could just read the NTITLE variable and i would get everything, without going to sqlite

bdanders

unread,
May 29, 2013, 9:01:15 AM5/29/13
to tas...@googlegroups.com
Could also try getting the message timestamp from the last message in each database. Whichever has the newer stamp is the most recent message.

Cameron DeCoster

unread,
Jun 27, 2013, 5:32:47 PM6/27/13
to tas...@googlegroups.com
Is there any way to expand the notifications for Hangouts and then read the text from the expanded notification?

On Monday, May 20, 2013 9:08:33 PM UTC-6, Roberto Cocchiararo wrote:
with google talk yyou could just read the notification TITLE (%NTITLE i believe) and it would read "SENDER said MESAGE"or something like that.

with hangouts if you have more than 0 unread mesages, it just says "n unread messages":(


On Monday, May 20, 2013 2:34:25 PM UTC-3, doc1987 wrote:

Cameron DeCoster

unread,
Sep 30, 2013, 5:17:37 PM9/30/13
to tas...@googlegroups.com
Has anyone been able to figure out a workaround for this issue?

Matt R

unread,
Sep 30, 2013, 6:17:27 PM9/30/13
to tas...@googlegroups.com
With root, try reading from the babel0 database in /data/data/com.google.android.talk/databases.

Matt

bdanders

unread,
Oct 1, 2013, 8:48:05 AM10/1/13
to tas...@googlegroups.com
With android 4.3 and AutoNotification you can get all the expanded information from the notification.

Cameron DeCoster

unread,
Oct 1, 2013, 11:17:01 AM10/1/13
to tas...@googlegroups.com
I'm not familiar with that plugin. How would one go about setting this up to get the expanded notification text?

Jay M

unread,
Oct 1, 2013, 12:50:31 PM10/1/13
to tas...@googlegroups.com

Theres tutorials on youtube (by the developer) and there's links in the plugins description on GPlay

Jay M

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/groups/opt_out.

Jay M

unread,
Oct 1, 2013, 12:53:27 PM10/1/13
to tas...@googlegroups.com

Cameron DeCoster

unread,
Oct 1, 2013, 1:01:20 PM10/1/13
to tas...@googlegroups.com, jaymen...@googlemail.com
Is this feature specific to 4.3? I'm still running 4.2.2.

bdanders

unread,
Oct 1, 2013, 1:33:01 PM10/1/13
to tas...@googlegroups.com, jaymen...@googlemail.com
Yes, making notification data available to all apps with permission was one of the enhancements added to 4.3.

wer linden

unread,
Sep 30, 2014, 12:08:00 AM9/30/14
to tas...@googlegroups.com
This works perfectly on my tablet.  Not on my phone.  hangouts (or presumably some other play services or some other emitter of intent guts) always sets %NTITLE so I can split and get sender and the body of the message, however my phone will queue things and say "2 new messages" instead of giving me a notification that is useful.
The phone which queues and screws up notifications and is unusable is 4.4.2 and hangouts 2.0.217 vs tablet which works every time and is awesome is 4.4.2 and hangouts 2.1.100.  I upgraded google hangouts to 2.3 on the phone but the tasker/hangouts/NTITLE functions the same (its useless beyond the first notification with NTITLE).  I don't even know where to begin to try to make this more useful on the phone.  I did all my tasker stuff on the tablet, which is not going to work on the phone as a result.  

I am so bumbed cause I was doing some cool stuff using my ghetto push notifications, and reading favorited contacts aloud at times.

Basically anything I do that is neat with android (which imply's tasker cause writing apps is a chore)  is inevitably ruined with some forced update, so why even try to do cool stuff with tasker?  hey hangouts, can I get some tasker integration please? No?  ok but you want my phone number and blood type anyway? all my text messages?  ok.  Just help yourself. 


Of course sms notifications can still be read/parsed.... but it's seems only a matter of time before hangouts aka almost google+ will forcibly ruin that as well.

The point is, using NTITLE and hangouts,  totally works, and is super useful.  Or it totally doesn't and isn't.  The behavior of which is likely buried elsewhere with peoples privacy concerns.

Sorry if that seemed like a rant, It's just that I was soooooo close.  I didn't need this form of automation on my tablet....  Now I wait for an alternative to android that is more open and concerned about my needs.  Not googles' needs.  tasker is so much fun that it needs even more hooks from even first parties.
 
On Tuesday, May 21, 2013 9:06:27 AM UTC-4, bdanders wrote:
You can get the content of a Hangouts message by storing the contents of %NTITLE in a variable upon receipt of a Hangouts notification. It's been working fine for me anyway.

John Doe

unread,
Sep 30, 2014, 7:28:23 AM9/30/14
to tas...@googlegroups.com
You just need to install Notification Listener plugin and read the variable %nlticker for the messages of Hangout, it's really simple. In addition the plug provides several variable to read other information.

wer linden

unread,
Sep 30, 2014, 5:25:24 PM9/30/14
to tas...@googlegroups.com

thanks.

Ah that uses the notification access.
I checked it out.    %nlticker never get's set or is available.   not sure what I'm doing wrong.   Thanks for chiming in.  I'll keep poking.

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/0wu338ypVV4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages