In its manifest, Automate is already registered to handle the "android.intent.action.VOICE_COMMAND" action, that's what's reported as the "Headset hook" button presses. The proper Media button API doesn't support it.
A audio playback is needed on Android 8+ otherwise the app wont get media button events, i.e. only most recent/current audio player does, hence the silent sample. That's not really needed for the
VOICE_COMMAND action, but since the Media button block can't handle any button dynamically, it's always played.