Alerting to Whatsapp message by matching keywords

1,067 views
Skip to first unread message

ryan...@gmail.com

unread,
Oct 5, 2016, 3:21:42 AM10/5/16
to Automate
I have a few whatsapp groups that i mute and want to be alerted when certain keywords are mentioned in the groups eg. my name.

I've managed to store keywords in a file separated by new lines, monitor whatsapp notification, and the notification part where it flashes my phone flashlight and TTS to prompt me but I'm having an issue to call file of keywords and compare with the string of text in the notification.

Any help would be much appreciated.

Florian HubSpace

unread,
Oct 5, 2016, 3:45:55 AM10/5/16
to automa...@googlegroups.com, ryan...@gmail.com
Hi.

Use jsonencode and jsondecode to store and load an array of all keywords in a text file.
http://llamalab.com/automate/doc/function/json_decode.html
When a new notification arrive you need to loop all keywords and check one by one with the function contains if the text contains the keyword. Count the findings.

ryan...@gmail.com

unread,
Oct 5, 2016, 7:44:19 AM10/5/16
to Automate
Contains() works great for this.

I used the "for each" block and "fork" to load all words in the file before waiting for WhatsApp notification and doing the compare().

Thanks a lot!

Reply all
Reply to author
Forward
0 new messages