The anatomy of a store-to-store sync
Note: Creating a task for this purpose does involve writing Liquid code.
Mechanic has two features that make syncing data possible:
Using these two features, you can create a pair of tasks, one in each store, one sending data to the other.
When creating a setup like this, follow these steps:
- In the destination store, set up a Mechanic webhook token, in your account settings. (Learn more about creating webhooks.) You might name the related event topic something like "user/sync/incoming". Make a note of the webhook URL that Mechanic generates for you.
- In the source store, set up a Mechanic task that subscribes to to an update event, like "shopify/inventory_levels/update". Use this task to create an "http" action that sends a POST request to the Mechanic webhook URL you created earlier, passing along whatever information you need to identify the matching resource in the destination store.
- In the destination store, set up a Mechanic task that subscribes to "user/sync/incoming" (or whatever event topic you chose earlier). In the task script, read the contents of the
event.datavariable, and use it to locate the appropriate resource (see: Querying Shopify), and then update its data using a "shopify" action.
This approach is appropriate for syncing in response to individual resources being updated in Shopify. For a bulk sync, the same structure applies, but the source store would subscribe to an event that's not related to a specific resource (say, "mechanic/scheduler/daily" or "mechanic/user/trigger"), and you'd send along a (potentially) much larger amount of data.
If you have questions about your specific implementation, use the chat button in the corner. :)