In Mechanic, a task is a bundle of logic and configuration, that responds to and interprets . The result of a task can define , which are the task's opportunities to have an effect on the world.
A task responds to events based on its . When an event is received that matches a subscription, the task processes the event using its . The code has access to the event data; it also has access to the user's task configuration, through . Task code is written in Liquid, and is responsible for rendering a series of JSON objects (including , , and objects), defining work to be performed once task rendering is complete.
A task uses its to communicate ahead of time the work it intends to do. Previews are important for users, and are also important for Mechanic itself â Mechanic looks to the task preview to understand what permissions a task requires.
Tasks may be written from scratch, or installed from the Mechanic library (available in-app and ). Once installed, a task's code may be modified at any time.
Working on getting better at task-writing? See , and .
Example
This very basic task subscribes to shopify/customers/create, and renders an , using an email subject and body taken from user-configured .