3 Filter iMessages from Unknown Senders
Apart from filtering spam messages, iOS 11 also has a feature for filtering iMessages from unknown senders. When enabled, you won’t receive any notification of messages that are sent by unknown people. These filtered messages are automatically moved to a separate list.
To enable iMessage filtering, go to Settings > Messages > Unknown & Spam and toggle on Filter Unknown Senders.