As far as I know, the APIs are rather limited.
You can use Accessibility Services. See my demo app here
This is a partial wrap/library for Android's Accessibility Services which you can read about here: https://developer.android.com/reference/android/accessibilityservice/AccessibilityService Android's Accessibility Services is meant to assisting users with disabilities in using Android devices...
It can be further extended of course
If it violates terms and conditions of WhatsApp and Google Play Store, I believe it's rather obvious and I don't think I need to comment on that ?