I need to use system events for shutting down and restarting the Mac

I have an app that uses com.apple.security.temporary-exception.apple-events. This works perfectly, but it has been rejected from the App Store. This is a service that exists outside the store, and I want to upload it. Is there any way of doing this process automatically without requiring user confirmation?