Mechanic
πŸ“£ Shopify REST Deprecation
  • ⛩️Introduction
  • πŸ€“Hire a Mechanic developer
  • πŸ’―status.mechanic.dev
  • πŸ“£Shopify is deprecating the REST API
  • πŸ™‹"I need something custom!"
  • πŸ§‘β€πŸ’»"I need help with my custom task!"
  • πŸ€–"I need help with my AI-written task!"
  • Resources
    • ⬇️Install Mechanic
    • πŸ§‘β€πŸ’»Task library
      • Contributing
      • Requesting
    • πŸš€Slack community
    • 🀝Partner directory
    • 🧠Tutorials
      • Video walkthroughs
        • Auto-tag orders by originating staff member
        • Maintain a tag for orders processed today
        • Auto-tag orders with their tracking numbers
        • Sync inventory for shared SKUs
        • Auto-tag products when their SKU(s) change
        • Auto-publish new products
        • Email a report of customers who haven't ordered in X days
        • Upgrading a Mechanic task: Adding a time delay
        • Email the customer when tracking numbers are added to their order
        • Adding an optional time delay to your Mechanic task
        • Delete all orders
        • Send an email when a specific product is shipped
        • Send recurring reminders about unpaid orders
        • Send an email when a product's price goes below its cost
        • Auto-tag customers by sales channel
        • Creating products in bulk
      • Creating a Mechanic webhook
      • Practicing writing tasks
      • Triggering tasks from a contact form
      • Creating scheduled CSV feeds
      • Fetching data from a shared Google sheet
    • πŸ†Converting tasks from Shopify REST to GraphQL
      • Conversion: Single resource lookups
      • Conversion: Resource loops to paginated queries
      • Conversion: Connections from a resource
      • Conversion: Metafield lookups from a resource
      • Conversion: Resource lookups in task option fields
  • Core Concepts
    • Events
      • Topics
      • Parent and child events
    • Tasks
      • Subscriptions
      • Code
        • Environment variables
        • Action objects
        • Error objects
        • Log objects
      • Options
        • Custom validation
      • Previews
        • Defining preview events
        • Stub data
      • Shopify API version
      • Advanced settings
        • Documentation
        • JavaScript
        • Perform action runs in sequence
      • Import and export
      • User Form
    • Actions
      • Cache
      • Echo
      • Email
      • Event
      • Files
      • Flow
      • FTP
      • Google Drive
      • Google Sheets
      • HTTP
      • Integrations
        • Report Toaster
      • Shopify
      • File generators
        • Base64
        • PDF
        • Plaintext
        • URL
        • ZIP
    • Runs
      • Scheduling
      • Concurrency
      • Ordering
      • Retries
    • Interacting with Shopify
      • Responding to events
        • Reconciling missing events
      • Reading data
        • ⚠️Liquid objects
        • πŸ†GraphQL in Liquid
        • Bulk operations
        • The Shopify action
      • Writing data
      • Shopify admin action links
      • API rate limit
      • API versions
  • Platform
    • πŸ”†Policies
      • Data
      • Plans
      • Pricing
      • Privacy
    • Cache
      • Cache endpoints
    • Email
      • Receiving email
      • Custom email addresses
      • DMARC
      • Email templates
    • Error handling
    • Events
      • Event topics
      • Event filters
    • GraphQL
      • Basics
        • Shopify Admin API GraphiQL explorer
        • Queries
        • Mutations
        • Pagination
      • Bulk operations
    • Integrations
      • Appstle Subscriptions
      • Google Drive and Google Sheets
      • Judge.me
      • Locksmith
      • Report Toaster
      • Shopify Flow
      • Run links
    • Liquid
      • Basics
        • Syntax
        • Data types
        • Variables
        • Comments
        • Filters
        • Operators
        • Control flow
          • Condition
          • Iteration
        • Whitespace
      • Liquid console
      • Mechanic filters
        • Deprecated filters
      • Mechanic keyword literals
        • array
        • hash
        • newline
      • Mechanic objects
        • Action object
        • Cache object
        • Event object
        • Options object
        • Task object
        • ⚠️Shopify REST Admin API
          • 🚫Article object
          • 🚫Blog object
          • 🚫Collection object
          • 🚫Customer object
          • 🚫Discount code object
          • 🚫Dispute object
          • 🚫Draft order object
          • 🚫Fulfillment object
          • 🚫Fulfillment order object
          • 🚫Fulfillment event object
          • 🚫Gift card object
          • 🚫Inventory item object
          • 🚫Inventory level object
          • 🚫Line item object
          • 🚫Location object
          • 🚫Metafields
            • Metafield object
            • Metafield representation object
            • Metafield collection object
          • 🚫Order object
          • 🚫Order risk object
          • 🚫Price rule object
          • 🚫Product object
          • 🚫Product image object
          • 🚫Refund object
          • 🚫Shipping zone object
          • 🚫Shop object
          • 🚫Theme object
          • 🚫Theme asset object
          • 🚫Transaction object
          • 🚫Variant object
      • Mechanic tags
        • liquid
        • action
        • assign
        • error
        • log
      • Mechanic code snippets
    • Shopify
      • Custom authentication
      • "Read all orders"
    • Webhooks
  • Techniques
    • Preventing action loops
    • Writing a high-quality task
    • Tagging Shopify resources
    • Debouncing events
    • Responding to action results
    • Working with external APIs
      • JSON Web Signatures
      • AWS request signatures
    • Finding a resource ID
    • Migrating templates from Shopify to Mechanic
    • Securing Mechanic webhooks
    • Monitoring Mechanic
  • FAQ
    • The app isn't loading. What do I do?
    • How do I stop a large batch of runs?
    • A Shopify event is missing. Where is it?
    • Does Mechanic have an affiliate program?
    • Can non-owners install Mechanic?
    • Can I replace Shopify's order emails with Mechanic?
    • Can I manually set Shopify permissions for Mechanic?
    • Does my theme need to be updated for Mechanic?
    • Do you have a plan for development stores?
    • Why don't I see any events in my task's activity?
    • Can I read data back from my webhook submission?
    • My task added a tag, but now the tag is missing – why?
    • How do I add an unsubscribe link to my emails?
    • How do I send images with my emails?
    • Can I re-send order confirmation emails with Mechanic?
    • Why am I seeing a different price than on the app store?
    • Do you have a Partner-friendly plan?
    • Why are my tasks delayed or not running?
    • My task is failing because of a permissions problem. Why?
    • How do I preview email attachments?
    • Can I query external APIs?
    • Why can't I access the Shopify API during preview mode?
    • How do marketing preferences work with Mechanic?
    • Can I send data to Google Sheets?
    • What's possible with timeline comments?
    • I'm getting a "query param length is too long" error when using GraphQL.
    • Can my Mechanic concurrency limit be raised?
    • What IP address does Mechanic use?
    • Can Mechanic read or manage customer subscriptions?
    • Why is everything harder now?
    • Can task content be translated into multiple languages?
    • Can I add a time delay to my task?
    • Can I add another store to my existing Mechanic subscription?
    • How can I reduce memory usage of my task?
    • How do I connect PayPal to Shopify with Mechanic?
    • How do I add a Shopify access scope to my task?
    • Can I have my Mechanic data retained for more (or less) than 15 days?
Powered by GitBook

Important Updates

  • πŸ“£ Shopify REST Deprecation
On this page
  • 1. Keys
  • 2. Display Order
  • 3. Flags
  • 3.1 Input‑type flags
  • 3.2 Form‑modifier flags
  • 3.3 Auxiliary flags
  • 4. Built‑in validation
  • 5. Liquid
  • 6. Quick reference
  • Working with date options

Was this helpful?

Edit on GitHub
Export as PDF
  1. Core Concepts
  2. Tasks

Options

PreviousLog objectsNextCustom validation

Last updated 3 days ago

Was this helpful?

accept user configuration via options. Options are created dynamically, by reference: each option referenced in a task's results in that option being added to the task's configuration form. In the option reference {{ options.foo_bar__required }}, the option key is foo_bar__required. The appearance and behavior of the option's form element is based on flags in in the option key – in this example, only the "required" flag is in use.

Mechanic flags provide only limited option validation. A task may define , by rendering error objects according to the task's its own validation logic.

1. Keys

Options are made available in the options variable, which is a hash having key-value pairs for each option key and option value. The option key must only contain ASCII numbers, lowercase letters, and underscores. The option key is reformatted for use as the option name presented to the user – underscores are replaced by spaces, and the entire line is sentence-cased.

<name>[__<flag>[ _<flag> ... ]]
Part
Rules
Example

name

Lowercase letters, numbers, and underscores only.

send_after

flag

One or more tokens that customise the field (see below).

required, date, picker_product

Because option keys are registered via static analysis, options must each be referenced using a standard lookup (e.g. options.foobar) at least once.


2. Display Order

Options are displayed to the user in the order in which they are first referenced in the task code.

Because this may not result in a natural sequence, it can be useful to prefix task code with a comment block, explicitly referencing each option so as to force the overall order.

{% comment %}
  Option order:

  {{ options.api_key__required }}
  {{ options.mode__select_o1_test_o2_live }}
  {{ options.webhooks__array }}
{% endcomment %}

3. Flags

Option flags control how an option appears and behaves in a task's configuration form, and also control the type and format of the option value.

Many flags may be combined with other flags, for more nuanced control.

If no flags are used for an option, an option will be made available as a plain text field, and the option value will be a string.

The special userform flag does not change the input type or validation; it simply marks an option as one that should appear on the Run-task form (topic mechanic/user/form) in additions to the general task options screen.

Flags fall into three categories:

Category
Purpose

Input types

Choose a specific control and value type (date picker, slider, select list, …). Exactly one input‑type flag should be used.

Form modifiers

Fine‑tune how the control looks or validates (required, multiline, etc.).

Auxiliary flags

Extra behaviour for certain input types (future‑only dates, multi‑select choices, etc.).

3.1 Input‑type flags

Flag
UI control
Value returned
Key examples

(none - default)

Single‑line text

string

options.subject

multiline

Multiline text box

string

options.body__multiline

boolean

Checkbox

true/false

options.enabled__boolean

number

Numeric input (step=1)

number

options.count__number

code

Code‑formatted text area

string

options.script_snippet__code_multiline

keyval

Key β†’ value repeater

hash

options.headers__keyval

array

Value repeater

array

options.tags__array

date

Calendar picker

"YYYY‑MM‑DD"

options.launch_date__date

datetime

Date+time picker

"YYYY‑MM‑DDTHH:MM"

options.send_at__datetime

time

Time‑only picker

"HH:MM"

options.quiet_time__time

color

Hex colour picker

"#RRGGBB"

options.theme_color__color

range_minX_maxY_stepZ

Slider + number box

number

options.qty__range_min0_max100_step5

select

Single‑choice dropdown

string

options.plan__select_o1_basic_o2_pro

choice

Radio buttons

string

options.tier__choice_o1_gold_o2_silver

multiselect

Checkbox list

array[string]

options.channels__multiselect_o1_email_o2_sms

picker_<resource>

Shopify resource picker

gid string

options.product__picker_product

picker_<resource>_array

Multi‑select resource picker

array[gid]

options.products__picker_product_array

Array options have a hidden feature: once the user-configured array reaches 5 elements in size, a new "Manage in bulk" button will appear for that option. Clicking it will open a modal which allows the user to manage the array's input using a single multiline text field, in which each line represents an array element. This is a convenient way to configure larger arrays.

Choice/Select grammar

Use ordinal tokens to define values:

<name>__select_o1_basic_o2_pro_o3_enterprise
               β”‚  β”‚     β”‚  β”‚
               β”‚  β”‚     β”‚  └───── value #2
               β”‚  β”‚     └──────── ordinal marker
               β”‚  └──────────── value #1
               └─────────────── ordinal marker

Ordinals (o1, o2, …) determine display order. Underscores inside values are preserved.

Range grammar

  • min<number> – required

  • max<number> – required

  • step<number> – optional (defaults to 1).

Picker grammar

<name>__picker_<product|variant|collection>[_array]
  • Append _array for multi‑select.

  • Unsupported resources are rejected during validation.

3.2 Form‑modifier flags

Flag
Applies to
Effect

required

Any

Field must be filled before Save.

email

text

Adds email placeholder and basic email format check.

userform

Any

Shows this option on Run task form (mechanic/user/form).

3.3 Auxiliary flags

Flag
Works with
Effect

futureonly

date, datetime

Picker disallows past dates.


4. Built‑in validation

  1. Required fields must not be empty.

  2. Range sliders need both min and max.

  3. Pickers only allow product, variant, or collection.

  4. Email inputs are matched against a basic regex.


5. Liquid

Options that allow text input are evaluated for Liquid when a task processes an event. Liquid evaluation for options occurs before it occurs for task code, which means that any Liquid variables created by task code are not available to task options.


6. Quick reference

Goal
Key snippet
Value example

Text input

options.subject__required

"Welcome!"

Email input

options.reply_to__email_required

"person@example.com"

Checkbox

options.newsletter__boolean

false

Key–value map

options.headers__keyval

{ "X-Env": "staging" }

String list

options.tags__array

["vip","wholesale"]

0–100 slider

options.score__range_min0_max100

42

Colour picker

options.bg__color

"#336699"

Dropdown

options.plan__select_o1_basic_o2_pro

"basic"

Multi‑select

options.channels__multiselect_o1_email_o2_sms

["email","sms"]

Product picker

options.promo__picker_product

"gid://shopify/Product/123"

Product list

options.products__picker_product_array

[ "gid://…/1", "gid://…/2" ]

Date

options.go_live__date_required

"2025-05-06"

Time

options.quiet_at__time

"00:25"

Datetime

options.party__datetime

"2031-04-22T15:13:00"

Working with date options

Getting a plain string (strip the offset)

{{ options.launch_date__date | date: "%Y-%m-%d" }}
   β‡’ 2025-05-06

{{ options.quiet_at__time  | date: "%H:%M" }}
   β‡’ 00:25

{{ options.party__datetime     | date: "%Y-%m-%d %H:%M" }}
   β‡’ 2031-04-22 15:13

Converting to another timezone

{{ options.party__datetime | date: tz: "UTC" }}
   β‡’ 2031-04-22T19:13:00Z       {offset shifted +4 h}

{{ options.quiet_at__time | date: "%H:%M %Z", tz: "America/Vancouver" }}
   β‡’ 21:25 PDT

Custom rules? Learn more about .

Liquid code in task options have access to the same set of that are made available to the task code, including event, shop, cache, and any event subject variables.

Tasks
code
custom validation
custom validation
environment variables