MacOS – way to add items to notification center through terminal or other means

macosnotifications

I'm wanting to add specific Websites to notification center (the stack exchange network, for example) and I want to be able to see various notifications that the website would send me.

Is there a way to add a website to be checked in notification center via terminal or some sort of script that can be written?

Best Answer

You can send a notification from the command line with this terminal-notifier utility. Getting the notification data off a site can be fairly involved, requires at least some decent scripting and/or web coding knowledge, and is probably a better question to pose on Stack Overflow.

The basic outline of such a script would be:

  • Open a site
  • Send login data if necessary
  • Scrape the page for the data you need (unless you're lucky and the site has a JSON or XML API, in which case you can parse that)
  • Send the appropriate data via the terminal-notify utility

This sort of thing may be more common in the future though, as Safari 6 and Mountsin Lion add support for web notifications, which will allow a site to display notifications, when Safari has an open tab for that site.

Support for this needs to be coded into the site however, so it's not really an end user solution I'm afraid.