Is there any way to view Chrome browser notifications history?

If you have a Mac, there is a way! 😄

Here's how the notifications list would look like:

Here's how the notifications list would look like.

All you have to do is:

1. In chrome, go to:

chrome://flags/

2. Look for:

Enable native notifications. Mac

3. Enable it, restart chrome, you are done. Enjoy!

EDIT:

  • You might not need to do the above anymore.

Starting in Chrome 59, notifications sent via the Notifications API or the chrome.notifications extensions API will be shown directly by the macOS native notification system instead of Chrome's own system. [source]

  • Test your notifications: https://web-push-book.gauntface.com/demos/notification-examples/

On MacOSX you will have Chrome directory located in Library/Application Support. Open terminal application and run next commands:

cd ~/Library/Application\ Support/Google/Chrome/Default/Platform\ Notifications/
ls -la

On Gnu/Linux (at least on Linux Mint), similarly you can find the log file(s) in /home/user/.config/google-chrome/Profile 1/Platform Notifications/ – jdmayfield

Now you will see files like this:

drwx------@  7 visi  staff   224 Jul 13 18:16 .
drwx------  75 visi  staff  2400 Jul 15 11:05 ..
-rw-------@  1 visi  staff   759 Jul 15 10:57 000003.log
-rw-------@  1 visi  staff    16 Jul 13 18:16 CURRENT
-rw-------@  1 visi  staff     0 Jul 13 18:16 LOCK
-rw-------@  1 visi  staff   147 Jul 13 18:16 LOG
-rw-------@  1 visi  staff    41 Jul 13 18:16 MANIFEST-000001

You can see the most recent one is 000003.log, so check it by next command:

tail -n 100 000003.log

And you will see last 100 items from this log. Then you can open chrome settings and disable that website notification.

Note that if you have several profiles in chrome, your path can be different, like this (Profile1 instead of Default):

cd ~/Library/Application\ Support/Google/Chrome/Profile\ 1/Platform\ Notifications/

If you are using MS-Windows, then go to %LocalAppData%\Google\Chrome\User Data\Default\Platform Notifications, there is a log file of past notifications.


As it seems not possible to get a record of the notifications directly, if I had the same problem, I would cheat by using an android phone emulator, or a phone, as the user who recommended Pushbullet. But there is not only Pushbullet, there are a lof of other apps, we could discuss the android tricks to listen and record notifications, in a separate thread.

If you are a programmer, you could maybe solve your problem though a home-made extension:

https://stackoverflow.com/questions/15949606/how-can-i-listen-to-notifications

"You can hook the webkitNotifications.createNotification function so that whenever a notification is created you run some particular code."


TL;DR:

For Ubuntu, jump down to the "final one-liner" TL;DR answer at the bottom.

Details:

This is modeled after @Andrey Bezpalenko's answer, but tested to be functional also on Ubuntu 18.04.

As is the case with his answer too, however, the output is pretty stinking ugly, as it's binary output with readable ASCII character strings intermingled in with the binary. Here are the steps:

  1. Find the latest log file (*.log) in the "Platform Notifications" directory for your Chrome installation:

     find ~ | grep --extended-regexp "google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1
    

Sample Output:

    $ find ~ | grep --extended-regexp "google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1
    find: ‘/home/gabriel/.cache/doc’: Permission denied
    /home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log

We can see we found the log file here: /home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log.

  1. View the last, let's say, 10 lines, or log entries, from this log file:

     tail -n 10 "/home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log"
    

Sample output of just the last 3 items (tail -n 3 "/home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log"). Notice how flippin' ugly this is to try to read and interpret!

    $ tail -n 3 "/home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log"
    o"link"dhttps://www.reddit.com/r/AskReddit/comments/est2b4/what_would_be_the_worst_thing_to_put_in_a_pi�ata/"correlation_id"$1b7b2ef8-3ebb-4532-81ec-f896e58edaff"
                                                                                                                                                                       message_type"lifecycle_post_suggestions" device_id"@a5df86650804f98993acc43b31efa4ec0c733485b8cef4d8fe64a01ad07e9e09"auto_dismiss_optionsobehavior"timed"dismiss_time_msI��{{X`�������hrz* p#https://www.reddit.com/#01019308@H����P�-X�-`�-hp���-��<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193�_Q��<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193�
                                                                                                                                                                  ��<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193��,����DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg�https://www.youtube.com/"�
    SpaceX In-Flight Abort Test"Recommended: NASA Video*�SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`�������hrz*�p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H�������hp�q�I���DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg�https://www.youtube.com/"�
    SpaceX In-Flight Abort Test"Recommended: NASA Video*�SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`�������hrz*�p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H�������`�hp������DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg�RESOURCES:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg

Or, just do all of the above in one single step:

tail -n 10 "$( find ~ | grep --extended-regexp "google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1 )"

Or even better, also print out the path to the log file:

TL;DR: the final one-liner:

LOG_FILE="$( find ~ | grep --extended-regexp \
"google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1 )"; \
echo -e "LOG_FILE=\"$LOG_FILE\"\n---------\n"; tail -n 10 "$LOG_FILE"

Further work:

Can anyone make this output look less horribly ugly? I'd like to see prior notifications in a more readable format!

Update 25 May 2020:

Here's one step closer to something useful: after running the "final one-liner" above, do this to extract just the ASCII chars from the binary, and remove extraneous spaces.

strings "$LOG_FILE" | sed -E 's/[ ]{8,}/\n/g'

First, strings extracts ASCII strings from the binary file. Then, the "'s'tream 'ed'itor", sed, 'g'lobally replaces all instances of 8 or more spaces in the 's'tring with a newline char, \n, since I noticed there were dozens if not hundreds of spaces in a row sometimes, which dramatically reduced readability. The -E in sed is to allow 'E'xtended regular expression searches.

Note that the one-liner command above already stored the file path into the LOG_FILE variable, so we are just going to re-use that variable here. See echo "$LOG_FILE" if you need to see what that variable holds.

After doing the above, you'll get something like this:

$ strings temp.txt | sed -E 's/[ ]{8,}/\n/g'
o"link"dhttps://www.reddit.com/r/AskReddit/comments/est2b4/what_would_be_the_worst_thing_to_put_in_a_pi
ata/"correlation_id"$1b7b2ef8-3ebb-4532-81ec-f896e58edaff"

message_type"lifecycle_post_suggestions" device_id"@a5df86650804f98993acc43b31efa4ec0c733485b8cef4d8fe64a01ad07e9e09"auto_dismiss_optionsobehavior"timed"dismiss_time_msI
{{X`
hrz* p#https://www.reddit.com/#01019308@H
<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193
<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193


<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193
DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
https://www.youtube.com/"

SpaceX In-Flight Abort Test"Recommended: NASA Video*
SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`
hrz*
p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H
DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
https://www.youtube.com/"

SpaceX In-Flight Abort Test"Recommended: NASA Video*
SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`
hrz*
p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H
DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
RESOURCES:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg

References:

  1. sed:
  2. explains how to use regex groups () and \1 \2 \3 etc to reference those groups! - https://unix.stackexchange.com/questions/78625/using-sed-to-find-and-replace-complex-string-preferrably-with-regex/78626#78626
  3. How to use sed to find and replace text in files in Linux / Unix shell - https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/