How can I write a script that opens a notification?
Testing under macOS High Sierra, the following line of example AppleScript code, when run, had the following general effects on a notification:

tell application "System Events" to ¬
    click every window of application process "Notification Center"



Open the app for which the notification was from, if it wasn't already opened.
If the app was already open, it would set focus to the app.
If notification from multiple apps, the app on the top notification in the list gets opened/focus, additions apps get opened, if not already open.


Note that with some notifications, they will be dismissed; however, with others, the app will still be opened/focused as applicable but the notification will not be dismissed. These will need to be replied to appropriately.