As described here com.apple.developer.usernotifications.filtering you have to use an extension and then to call contentHandler(UNNotificationContent()) to suppress a notification. As for the APS-Payload "mutable-content" has to be set and it has to be an alert. Without "mutable-content" your notification is not being called.
Topic:
App & System Services
SubTopic:
Notifications
Tags: