Code
Write task code in Mechanic's Liquid environment — render actions, logs, and errors in response to events.
A task's code is a Liquid template. In the same way that a Shopify storefront might use a Liquid template to receive requests and render HTML, a task uses its Liquid code to receive events, and render a series of JSON objects. These JSON objects define actions, logs, and errors.
Task code always has access to a set of environment variables, which can be used to make decisions about what JSON objects to render.
A task must purposefully consider its preview, so as to accurately communicate its intent to users and to the Mechanic platform.
See also
Liquid basics — syntax, data types, variables, filters, and control flow
Mechanic filters — Mechanic-specific filters for data manipulation
Mechanic tags —
{% raw %}{% action %}{% endraw %},{% raw %}{% log %}{% endraw %},{% raw %}{% error %}{% endraw %}, and moreMechanic objects — event, task, options, cache, and action objects available in your code
Writing a high-quality task — patterns and practices for reliable Mechanic tasks
Last updated
Was this helpful?