Actions
Actions are how Mechanic tasks make changes — Shopify mutations, emails, HTTP requests, file generation, and more.
An action is an operation with an effect — tagging an order, sending an email, uploading a file to FTP, or calling an external API. Tasks produce actions by rendering action definitions in Liquid, which means a single task can dynamically generate any number of actions based on the data it processes.
Actions run after the task code completes. Each action has a type (specifying the operation) and options (providing specifics). Action definitions can be constructed using the action tag or as raw action objects in JSON.
In Mechanic, actions are performed after their originating task run concludes. Actions are not performed inline during the task's Liquid rendering.
To inspect and respond to the results of an HTTP action, add a task subscription to mechanic/actions/perform, allowing the action to re-invoke the task with the action result data.
If you don't need the follow-up event for a particular action, add __perform_event: false to that action to skip emitting mechanic/actions/perform while still performing the action.
To attach meta while using any of the action tag syntaxes, add __meta and Mechanic will move that value into the action's meta field.
Learn more: Responding to action results
Action types
An action type determines the class of operation to be performed. While actions may vary greatly, there are only a few action types. Shopify is treated as a first-class action because it's the primary API Mechanic automates against.
Performing operations on the store's Mechanic cache
Debugging; displays the options that it is provided, with no side-effects
Sending transactional email
Generating custom events in the User event domain
Generating files of various types, storing them at a temporary Mechanic-provided URL
Performing FTP file uploads and downloads
Performing HTTP requests
Sending requests to the Shopify Admin API
Integrations
Mechanic also maintains a set of integration actions for third-party services beyond Shopify.
Report Toaster
Requesting reports from Report Toaster, or updating data within Report Toaster
Last updated
Was this helpful?