Actions

In Mechanic, an action is an instruction for performing work that has an effect. Actions are generated by tasks, in response to events. Each action has a type, specifying the class of operation to be performed, and options, providing specifics about what that operation will do.

Actions are defined by tasks using action objects, which are simple JSON objects specifying an action's type and options. Action objects can be constructed using the action tag.

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.

Action
Purpose

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 user events

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.

Action
Integrated service
Purpose

Airtable

Create and edit tables and records in Airtable

Shopify Flow

Sending customer, order, product, and general triggers to Shopify Flow

Google (Drive and Google Sheets)

Advanced integration with the Google Drive and Sheets APIs

Google Drive

Upload files to Google Drive

Google Sheets

Create, Update, Export Google Sheets

Report Toaster

Requesting reports from Report Toaster, or updating data within Report Toaster

Slack

Posting messages to Slack

Last updated

Was this helpful?