To grant the applescript permission to send events, before notarizing, I had to sign and add an entitlements file.
codesign --sign #{SIGNATURE} --options=runtime --entitlements=script.entitlements #{file}
Then contents of that file is just:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.automation.apple-events</key>
<true/>
</dict>
</plist>
Topic:
App & System Services
SubTopic:
Core OS
Tags: