Alfred 5 is here - Find out what's new

External Trigger

External triggers provide you with external access to specified points throughout your workflow. 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.

External triggers can be accessed within a workflow via the Call External trigger object, or externally using AppleScript or the URL Handler.

An Inbound Configuration set up with an external identifier will behave the same as using an external trigger and provides additional configuration options.

New in Alfred 5

It is now possible to call an external trigger via the alfred://runtrigger/ URL Handler.


Getting your sample code

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 from outside Alfred.

Sample code

In this example, the workflow has a Bundle ID of com.alfredapp.andrew.bananas and External Trigger ID of eat. The AppleScript and URL to trigger the object are, respectively:

tell application id "com.runningwithcrayons.Alfred" to run trigger "eat" in workflow "com.alfredapp.andrew.bananas" with argument "test"

alfred://runtrigger/com.alfredapp.andrew.bananas/eat/?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.

Bundle ID error

A good bundle ID format is com.domain.yourname.workflowname (for example: com.alfredapp.andrew.bananas) but as 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: -1
  • Workflow Not Found: -2
  • Trigger Not Found: -3
  • Workflow Disabled: -4

Latest Blog Post:

Introduction to Automation Tasks

CacheFly Campaign Monitor

"Alfred" is a registered trademark of Running with Crayons Ltd. ©2022 Running with Crayons Ltd. All rights reserved.

Terms & Conditions, Privacy Policy, Cookies.