Open url with urlhandler in background

I’m trying to simplify communication between my application and Filemaker. My app is calling a Filemaker script with AppleScript. This is done async. I have had a rather complicated solution in place to let me know if the data processing is finished. I thought to simplify this by calling a custom urlhandler to my app.

The custom urlhandler works fine but it puts my app to the foreground. Is there a way not to do this? I’ve done a bit of Goggling but didn’t find anything useful.

Any ideas?

I could use an AppleEvent but I’d rather not have even more problems with the stupid permissions on Mojave.