An introduction to events

Everything happens, in e-commerce. Products are listed, customers arrive, orders are placed, everything occurs, and has data to go with it.

In Mechanic, we call that whole wash of things events, and each event has two important parts: a topic, and data.

Event topic

A topic reads like "When a customer is created", or "When an order is paid", and you'll see phrases like these across the Mechanic interface.

Event data

Naturally, knowing that a customer has been created is not enough: you'll want to know which customer, and what their account looks like.

To this end, when Shopify sends Mechanic an event, it brings with it a bunch of information that we call the event data.

For developers

Event topic

Under the hood, these values are things like "shopify/customers/create", and "shopify/orders/paid", and they correspond to Shopify webhooks. Shopify has a wide variety of these topics available for your use: read more in the Shopify docs, or check out our master list of event topics.

When you're setting up a task, Mechanic will ask you for the event topics that you want the task to watch for. You can use one topic, or as many as you like! You can also use zero topics, which is tantamount to disabling the task.

When you're writing the script for your task, you can access the current event topic using  {{ event.topic }}.

Event data

This is a payload that you can use, and you get to play with it using task scripts.

When you're writing the task script, you can access the event data using {{ }} . Or, you can use the variable corresponding to the current event subject: for a customer-related event, for example, you could use {{ }}, or {{ }}  – whichever feels more natural to you.

Read more about task scripts here.

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