This task and profile set enables voice notifications for Whatsapp messages.
The voice notification will not fire if the phone is facing upwards1 or if the screen is turned on2.
The voice notifier will replace unknown numbers3 with the word "unknown" to skip reading out the full number.
Note: If your phone is on silent, the voice notification respects that!
You need to create 2 profiles (one is reusable for all IM) and 1 task.
Just a tiny bit of coding
New state profile named GetPosition
based on State > Sensor > Orientation > Face Up > Inverted
Attach anonymous task:
- Variable Set Name %isUp To False
New task named WhatsappNotifier
- If %SCREEN ~ off
- Variable Set Name %isUp To True
- Profile Status Name GetPosition Set On
- Wait MS 512 Seconds 0 Minutes 0 Hours 04
- Profile Status Name GetPosition Set Off
- If %isUp ~ False
- Variable Split Name %NTITLE Splitter :
- If %NTITLE1 ~R \+(?!\w)5
- Variable Search Variable %NTITLE1 Search ^([\w\-]+) Replace Matches on
- Variable Search Variable %NTITLE1 Search ^([\w\-]+) Replace Matches on6
- Say Text Whatsapp from %NTITLE1
- ELSE
- Say Text Whatsapp from unknown
New event profile named Whatsapp
based on Event > UI > Notification
Set Owner Application to WhatsApp
And attach WhatsappNotifier task
Exit and Enjoy. OR take it one further!
The same set can be applied for other IM, just take care with the step where you extract the sender's name, as Whatsapp notifications uses the structure:
Message from sender:
where others like Telegram only use:
sender: