AppleScript read and trigger other script base on received notification
This following AppleScript code should work if you save it as a “stay open” application.  Just set the property values for scriptToRun and lookForThisText and it should be good to go.
Don’t forget to grant permissions in System Preferences for your new stay open application to control your computer
property scriptToRun : (path to desktop as text) &amp; &quot;your.scpt&quot; -- your path to .scpt file
property lookForThisText : &quot;Search For This Text In Notification Windows&quot; -- your search term
property theseTitles : {}

on idle
    getNotificationTitles()
    delay 0.1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 6 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        ---------------------------------------------------------------
    end if
    return 1 -- in seconds
end idle

on quit
    --  Executed when the script quits
    continue quit -- allows the script to quit
end quit

on getNotificationTitles()
    -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
    tell application id &quot;com.apple.SystemEvents&quot;
        tell (the first process whose bundle identifier = &quot;com.apple.notificationcenterui&quot;)
            set theseWindows to every window whose subrole is ¬
                &quot;AXNotificationCenterAlert&quot; or subrole is &quot;AXNotificationCenterBanner&quot;
            set theseTitles to {}
            repeat with thisWindow in theseWindows
                set titleText to the value of static text 1 of thisWindow
                set the end of theseTitles to titleText
                set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                set the end of theseTitles to subTitleText
                set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                set the end of theseTitles to notificationText
            end repeat
        end tell
    end tell
end getNotificationTitles


Here is a quick animation showing the process in action.  I created an AppleScript app named Test Notification.app whose only purpose is to display a notification… display notification &quot;Blah&quot; with title &quot;BLAH BLAH&quot; subtitle &quot;DUH” Then, using the code I used as the answer to this post, I created a “Stay Open Application”, whose only purpose is to monitor all incoming notification windows for the text in which I define in the variable lookForThisText.  Once the text is identified, it triggers another script &quot;Merge Every Finder Window.scpt&quot; which as the name says… merges every Finder window.