In case it helps someone else, this was a little trickier to set up than I thought it would be.
- In Alfred, add an External Trigger (as mentioned by @vco1). Call it whatever you want. Ignore the second text box for now.
- Still in Alfred, double-click the workflow in the left sidebar and give it a bundle identifier. Something like
com.alfredapp.workflows.yourworkflowname
. - Reopen the External Trigger you added in (1), and copy the sample code from the box.
- Install the OSA Script plugin from the Stream Deck plugin gallery.
- Add a Run OSA Script action to your Stream Deck.
- Paste the code block you copied in (3) into the run action.
- Make sure Stream Deck has permissions in macOS Security & Privacy → Privacy tab → Full Disk Access.
That should be it!
Edit: I should add that I prefer this script-based approach over simulating keystrokes or keypresses because it eliminates the chance that a keypress conflict will occur. The script-based approach guarantees that only this workflow will be executed when you run the Stream Deck action.