Notification contact number access

I need when a notification arrives to get only contact number or name to send to him a sms.
For example when a whasapp notification arrives I get the number of contact and send an automatic response.

Is it possbile?