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

Event topics are three-part strings, like "shopify/customers/create", or "mechanic/user/trigger", or "user/foo/bar". Classified by their domain (e.g. "shopify") and subject (e.g. "customers"), they identify the origin and nature of the event.

All Shopify webhooks (docs) are supported as events for Mechanic, and we add our own compliment of useful events under the "mechanic" domain.

For the complete list of topics, see All event topics.

When you're writing a task, Mechanic will ask you for the event topics that you want the task to subscribe to. 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 {{ }}. For Shopify events, Mechanic automatically constructs an object named after the event subject, and that object often includes additional functionality. For example, the "shopify/customers/create" event would make available a variable called "customer", set to a customer object, allowing you to make calls that look like {{ }}, or {{ }}.

Learn more: An introduction to tasks.

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