Task subscriptions

Subscriptions control what events a task responds to. They have two pieces:

  1. The event topic (e.g. shopify/orders/create)
  2. Optionally, a time delay (e.g. +1.hour)

Event topics are plentiful. Time delays can be in minutes, hours, days, weeks, months, or years.

A quick warning about time delays

The variables Mechanic makes available to you ( customer for a customer-related event, product for a product-related event, etc) all contain the data that arrives with the original event. If you are using a time delay, this data will be stale/outdated by the time the task runs. Using out-of-date data is problematic, to say the least!

The solution: reload the variable. For example, add this to the top of your task script to make sure you are using the most recent customer information available:

{% unless event.preview %}
  {% assign customer = customer.reload %}
{% endunless %}

This code ensures that, when performing a task against a real, non-preview event, the customer variable will contain up-to-date values. We prevent this from happening during previews, because Mechanic does not permit live access to the Shopify API during preview mode.

Standard subscriptions

By default, subscriptions are specified as a simple list, separated by newlines. This is the easiest way to establish when a task is supposed to run.


  • shopify/customers/create 
  • mechanic/scheduler/tuesday+9.hours 

Liquid subscriptions

By clicking the "Enable Liquid" link in the subscription editor, you can start editing your subscriptions using Liquid code.

Combined with the options object, this creates a powerful mechanism for subscribing tasks based on merchant configuration. This means subscriptions can be conditionally added and dynamically generated.

When composing your Liquid subscriptions, make sure that one event subscription is given per line.



{% if options.send_email_when_order_cancelled__boolean %}
{% endif %}
shopify/orders/paid+{{ options.days_to_wait_before_followup__number_required }}.days
shopify/customers/create{% if options.minutes_to_wait__number != blank %}+{{ options.minutes_to_wait__number }}.minutes{% endif %}


Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.