I think the name of the contact appears in notification's title. Its number if you don't have it saved as contact.
You could use set string variable action to save notification's title and notification received trigger.
You could be checking if this variable contains number instead contact name (there are few ways to implement this) and then perform actions for numbers (not saved contacts) or dont perform them (for contacts).
To send the message you would use either notification interaction(if notification allows it) or launch app action and fill the clipboard + ui interactions (paste and all needed clicks).
It might be a little bit complex to achieve if you are not too familiar with macrodroid yet but I think it could be done.
You can check this thread, I was helping here with automating actions when message from chosen contact from whatsapp sends message. It might help you get the general idea of how it would work.
Currently, my wife has to use the keyword "hello" for Macrodroid to flash an LED light for me so I can check the message. Often, my wife forgot to use that keyword but no flash :( The setting that works for me so far is ... (T) Notification Receieved (WhatsApp) [Contains :*hello*...
www.macrodroidforum.com