¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Get macOS Notification Center messages in Node Red


 

Hello
?
in order to have the DX Alarms I've defined in the logger/cluster (RumLog) on my dashboard I'd like to get and then handle notification messages coming from my Mac into Node Red.
I did several temptatives using node-red-contrib-sysmessage node with no success (I tried using 5223 or 443 or 2197 Tcp ports)
Can anybody give me some help/suggestion/example ?
Many thanks in advance, regards
?
Giorgio
?


 

That node was last updated 9 years ago. It's very likely that the OS X notification system has been completely overhauled since then.
?
I don't have a solution for you, but this is what ChatGPT thinks you should do.

Option 1: Using AppleScript + Node-RED

AppleScript can listen for notifications from specific apps and send them to Node-RED using HTTP or MQTT.

Steps:

  1. Create an AppleScript to Listen for Notifications Open the Script Editor (/Applications/Utilities/Script Editor.app) and enter this:

    applescript
    Copy code
    on notify(theApp, theTitle, theMessage) do shell script "curl -X POST -H 'Content-Type: application/json' -d '{\"app\":\"" & theApp & "\", \"title\":\"" & theTitle & "\", \"message\":\"" & theMessage & "\"}' http://localhost:1880/notifications" end notify

    Save it as NotificationListener.scpt.

  2. Create a macOS Automator Service

    • Open Automator (/Applications/Automator.app).
    • Select New > Service.
    • Add an AppleScript action and paste the script above.
    • Save the service and name it something like "Send Notification to Node-RED".
  3. Route Notifications to This Service

    • Open System Preferences > Notifications.
    • Select an app you want to monitor (e.g., Slack, Mail, Messages).
    • Change Notification Style to Alerts (if needed).
    • Check if Automator detects the notifications and runs the script.
  4. Set Up Node-RED to Receive Notifications

    • In Node-RED, create an HTTP In node (POST /notifications).
    • Connect it to a debug node or process it further.

Option 2: Using Swift + Background Script

A more advanced approach is to use a Swift script to listen for system notifications globally. This would require writing a small macOS app that captures notifications and forwards them to Node-RED via MQTT or HTTP.

Let me know if you¡¯d like a Swift-based solution, and I can guide you through it! ?

?
73,
Scott
AK5SD


 
Edited

Thank you so much Scott !!
?
I like very much option 2 via MQTT. I have a Debian machine here h24 7/7 hosting MQTT mariaDB Node Red and more that cares of my little shack integration.
Yes any help/guidance is absolutely welcome ! I Many thanks in advance
Best 73
Giorgio


 

Hi Scott
I did some tries using AppleScript+Node-RED flollowing steps suggested but no luck.
I'd would approach Swift based solution, but I never used Swift
When you'll have time could you please guide me ? No urgency here so take your time
Feel free to contact by mail (avoiding this way to waste space in this group) ik1bxn@...
Many thanks in advance, best regards
Giorgio


 

Sorry, I am not a Swift developer.
?
73,
Scott
AK5SD