Some ideas for playing a notification sound in a script runtime:
Shell
# system beep; also flashes the screen if you have that enabled in accessibility
osascript -e 'beep'
# play the sound file given by the file system the path
afplay /System/Library/Sounds/Hero.aiff
AppleScript
beep
do shell script "afplay '/System/Library/Sounds/Hero.aiff'"
JXA + Cocoa API
$.NSBeep()
// search for and play a sound file; the lookup path is defined by macOS
$.NSSound.soundNamed('Glass').play
Shell
AppleScript JXA + Cocoa API