Mattermost recipe: Client notifications on macOS

Some of our users had problems regarding the notification settings in macOS’ system preferences and the desktop app. The main confusion is about the absence of the Mattermost entry in this settings menu and the reason is quite simple. If one haven’t got any notifications from the desktop app (this is true for every other app as well) nothing is registered in the settings menu because macOS simply doesn’t know anything about the notifications from this specific app at this point. After receiving the first notification macOS should ask if these notifications are allowed or not. If ‘Don’t allow’ was clicked or no dialog shows up like below

the notification settings can be removed with a rather complicated method. To reset this the /Users/$USER/Library/Preferences/com.apple.ncprefs.plist file needs to be altered; this can be done with preinstalled macOS tools or GUI programs from the Internet.
On my macOS this plist file was in binary format (plist files can be in json, xml or binary format) and therefore this needs to be converted first. With plutil -convert xml1 /Users/$USER/Library/Preferences/com.apple.ncprefs.plist this file can be made readable and afterwards i edited this with a text editor. There is also a tool called defaults which can write keys but because the notification settings are stored as dictionaries in an one key array this will be not easy to alter.
After the file was converted one can search in the text editor for an entry similar (with the same bundle-id but different data) to mine

and delete this dictionary altogether; from the first <dict> to the last </dict> as seen in the screenshot.
Now i converted the file back to binary format with plutil -convert binary1 /Users/$USER/Library/Preferences/com.apple.ncprefs.plist and logged out. After logging in back to my user the previous setting is gone and at the first notification received i was asked again.

2 Likes

Unfortunately I’m still unable to get the prompt. I’ve had a user send me a message. Made a post about it here: Not Registering In Mac Notifications Center

Is there anything else you can think of that might trigger the prompt?