How to automatically hide notifications after a timeout in OS X Sierra?
System Prefs > Notifications
On a per-app basis, you need to switch from Alerts to Banners ...
Banners appear in the upper-right corner and go away automatically. Alerts stay on screen until dismissed.
According to this Apple Developer Manual entry, in AppleScript you programmatically dismiss an alert after a specified period of time.
display dialog "Do, or do not. There is no try." giving up after 5
--> Result: {button returned:"OK", gave up:true}