External triggers provides you with external access to specified points throughout your workflow. These can be accessed externally using AppleScript, or within a workflow using the Call External trigger object.
This is useful if you'd like to integrate workflows into your scripting outside of Alfred, and can also provide a way of calling between workflows.
New in Alfred 4.1
It is now also possible to add an External Identifier directly to a workflow object using Inbound Configuration. Setting an external identifier on an object will behave the same as using an external trigger, and also provides some additional configuration options.
Getting your sample AppleScript
Once you've added an External Trigger object to your workflow, double-click it to show the dropdown sheet. Enter the identifier used to uniquely access this trigger using AppleScript outside Alfred.
In this example, the workflow has a Bundle ID of
com.alfredapp.andrew.bananas and External Trigger ID of
eat, the AppleScript to access this externally is:
tell application id "com.runningwithcrayons.Alfred" to run trigger "eat" in workflow "com.alfredapp.andrew.bananas" with argument "test"
Why am I seeing a bundle ID error?
Before your sample code can be generated, you'll need to make sure your workflow has a bundle ID - otherwise you'll see this error message.
To add a bundle ID, double-click on the workflow name in the left sidebar. Fill in the bundle ID and save to make the error disappear.
A good bundle ID format is
com.domain.yourname.workflowname (for example: com.alfredapp.andrew.bananas) but so long as you fill something unique in, you'll be fine.
Error Codes for External Triggers
When calling an external trigger from AppleScript, if an error occurs, the following error codes are output:
- Unknown Error:
- Workflow Not Found:
- Trigger Not Found:
- Workflow Disabled: