Connectors / Service / Shopify

Shopify gives you everything you need to build a successful online business. (updated: 1657717996061)

Shopify

Shopify is an E-commerce platform for online stores and retail point-of-sale systems.

Overview

The Shopify connector currently provides operations to manage orders, fulfilments and customers in your shop be it online, on social media, or in person.

Shopify templates

Please note that we have the following Shopify templates available:

These will give you pre-configured best practice ways of working with Shopify and integrating it with other connectors.

However, please continue to at least read the Authentication and Trigger setup instructions on this page to enable you to get started with using Shopify.

Authentication

When using the Shopify connector, the first thing you will need to do is go to your Tray.io account page, and select the workflow you wish to work on. Once in the workflow dashboard itself, search and drag the Shopify connector from the connectors panel (on the left hand side) onto your workflow.

With the new Shopify connector step highlighted, in the properties panel on the right, click on 'New Authentication' which is located under the 'Settings' heading.

shopify-auth-new

Version 1.2+

As of v1.2 the Shopify connector uses OAuth as its authentication method.

So when you click on 'New Authentication' you will be presented with the following screen, where you can specify the domain of your store, and the permission scopes you want the Tray.io app to have.

shopify-con-trig-auth

Your domain name is displayed in the URL of your main Shopify dashboard. For example, if "west.shopify.com" and "east.shopify.com" are both URLs with the root domain "shopify", this means that "east" and "west" are the SUBDOMAINS.

Copy yours over and make sure you set you permission scopes as appropriate. There are several scopes to choose from so make sure to scroll through to view them all.

IMPORTANT!: Please make sure that the account you are authenticating with has thecorresponding permission scopes else this will not authenticate properly!.

shopify-auth-permissions

Once you click 'Next', you will be presented with a popup login screen for Shopify and to enter your access credentials - provided you are not already logged into your Shopify account.

Version 1.1 and earlier

If you are using v1.1 or earlier, your popup will be different, and as you can see, besides from naming your authentication appropriately, you will need your 'API key', 'API Password' and 'Shop subdomain'.

shopify-auth-v1

In order to get these, first log into the Shopify app and head to the admin section; choose "Apps". Click on "Manage private apps" (near the bottom of the page).

shopify-auth-v1-manage-apps

Then click on "Create a new private app".

shopify-auth-v1-create-new

In the "App details" section, enter a name for the private application and a contact email address as appropriate.

Within the "Admin API" section, select the areas of your store that you want your app to be able to access. Click "Save".

You should now see the 'API key', 'API password' and your 'Shop subdomain' name (in the "Admin API" section).

shopify-auth-v1-api-creds

Copy these pieces of information and paste them into your Tray.io auth window as displayed earlier, including your subdomain name. If your shop URL is: https://traytest-123.myshopify.com , you will enter traytest-123 as you subdomain.

Once you have clicked the 'Add authentication' button, go to back to your authentication field (within the workflow dashboard properties panel from earlier), and select the recently added authentication from the dropdown options now available.

Your connector authentication setup should now be complete.

Shopify Trigger

If you wish your workflow to be kicked off by a particular action in Shopify, you can use the Shopify Trigger.

The Shopify trigger allows you to receive notifications and trigger workflows when given events occur associated with the selected trigger operation.

Version 2.0+

Trigger operations available:

  • GDPR Webhook

  • Webhook

Webhook Setup

When creating a new workflow, click the 'Create new workflow' button in the top right hand corner of your main Tray.io dashboard. When the trigger popup window opens, search and select the Shopify trigger. Wait to be redirected to your new workflow and the workflow dashboard itself.

shopify-select-trigger

With the new Shopify trigger step highlighted, in the properties panel on the right, click on 'New Authentication' which is located under the 'Settings' heading.

shopify-auth-new

This will result in a Tray.io authentication pop-up window, that should look like this:

shopify-con-trig-auth

As of v2.0 the Shopify connector uses the same OAuth authentication method as the standard Shopify connector (version 1.2+).

Follow the instructions above in the v1.2+ authentication tab to set up your trigger, and select 'Webhook' as the event you want your trigger to listen to (aka the operation), in order to set off the workflow itself.

WEBHOOKS: As this uses a webhook as its operation type, you will also need to integrate it with your Shopify account, in order to complete the authentication process.

Below is an example of a way in which you could potentially use the Shopify connector, to use the 'Search customers' operation and specify orders_count:0 into the 'Query' property. I.e: to search for customers that haven't ordered anything on your shop.

Additionally, you can specify only a set of fields that should be in the output by adding them in the 'Fields' property such as id , name .

The steps will be as follows:

  1. Set up Shopify trigger and boolean branch.

  2. Add a Slack connector notification step.

The final outcome should look like this:

shopify-complete-workflow

PLEASE NOTE: This is an over simplified example - you would normally use the data to updatea record in Salesforce, or something similar.

1 - Setup trigger & Boolean branch

Once you have clicked 'Create new workflow' on your main Tray.io dashboard (and named said new workflow), select the Shopify trigger from the trigger options available:

shopify-select-trigger

> Make sure you have set up your trigger as explained depending on the version you are using, before going any further.

Once you have been redirected to the Tray.io workflow dashboard, from the connectors panel on the left, add a Boolean connector to your second step. Set the operation to 'Boolean condition'.

If you have used the 'Send test notification' option, from the admin section in your Shopify webhook dashboard (as detailed earlier in the trigger section above), you should have gotten an output similar to the below:

This is viewable in the Debug panel under your step output.

shopify-test-output

The data sent by the Shopify webhook can be extracted and used with a jsonpath beginning with either $.steps.trigger.topic or $.steps.trigger.data.[field].

JSONPATHS: For more information on what jsonpaths are and how to use jsonpaths with Tray.io, please see our Intro page and Data Guide for more details.

You can achieve most of this path by using the connector-snake to save you time and effort.

CONNECTOR-SNAKE: The simplest and easiest way to generate your jsonpaths is to use our feature called the Connector-snake. Please see the main page for more details.

In our case we will create a boolean branch to check if the user accepts marketing, by setting the comparison type to 'Equal to' and the second value to 'The 2nd of 2 values to compare'.

> Take special notice of the Input types! if they are net set correctly, your condition will fail.

shopify-boolean

2 - Add a Slack notification

Add a Slack connector step to your workflow on the TRUE branch. Set up your auth and set the operation to 'Send message'.

Choose your channel, and then use Tray.io's interpolation method to have your result displayed in the message output.

Note the use of { } to input the result of the jsonpath in to a string field

INTERPOLATION: When you wish to include JSON generated data within another input/output result, use our Interpolation method as described here.

shopify-slack

Now, whenever the boolean branch returns a TRUE result, a notification message will be sent to this particular Slack channel, to let people know that a user (as identified by their email address) has accepted the marketing material.

BEST PRACTICES: Whenever you do decide to create your own workflow, please make sure you take a look at our managing data best practices guide.

All Operations

Latest version:

4.2

Cancel fulfillment

Cancels a fulfillment.

Cancel order

Cancels an order. Orders that have a fulfillment object can't be canceled.

Close order

Closes an order.

Complete draft order

Complete a draft order, transitioning it to an order.

Complete fulfillment

Completes a fulfillment.

Count customers

Returns the number of customers in your store.

Count fulfillments

Returns the number of fulfillments associated with an order.

Count locations

Returns a count of locations.

Count orders

Returns the number of orders in your store.

Count products

Returns the number of products in your store.

Create account activation url

Creates a new account activation url.

Create customer

Creates a new customer.

Create draft order

Create a draft order.

Create fulfillment

Creates a new fulfillment.

Create inventory level

Connects an inventory item to a location by creating an inventory level at that location.

Create inventory level for item at location

Sets the inventory level for an inventory item at a location. If the specified location is not connected, it will be automatically connected first.

Create metafield

Creates a new metafield for the specified resource.

Create new product image

Create a new product image with included image data as attachment

Create order

Creates a new order.

Create product

Creates a new product. To add product variants via the create product variant operation, please define the variant possibilities by explicitly defining all of the options (max 3).

Create product image with image URL

Create a new product image with a given image URL.

Create product variant

Creates a new product variant. Please note that in order to use this operation, the variant options must already be defined on the product.

Delete customer

Deletes a customer.

Delete inventory level

Deletes an inventory level of an inventory item at a location..

Delete metafield

Delete a specific metafield

Delete order

Deletes an order.

Delete product

Deletes product with given ID.

Delete product variant

Deletes a product variant by ID

Get Location

Returns a single location by its ID.

Get Location inventory levels

Returns a list of inventory levels for a location.

Get collection

Retrieves a collection.

Get customer

Returns information about a customer.

Get fulfillment

Returns information about a fulfillment.

Get inventory item

Returns a single inventory item by ID.

Get metafield

Return's metafield data for chosen resource.

Get order

Returns information about an order.

Get product

Returns information about a product.

Get product variant

Returns a product variant by ID

Get shop configuration

Returns information about your shop.

List collection products

Returns the products associated with a collection.

List collects

Returns a shop's custom collections. NOTE: This operation no longer returns smart collections.

List countries DDL

List customer orders

Returns a list of orders for a specific customer.

List customers

Returns a list of customers.

List customers DDL

List fulfillments

Returns a list of fulfillments associated with an order.

List inventory items

Returns a list of inventory items.

List inventory levels

Returns a list of inventory levels.

List locations

Returns a list of locations.

List locations DDL

List metafields

Retrieve a list of metafields for a specified resource

List orders

Returns a list of orders.

List orders DDL

List product images

Returns a list of product images.

List product images DDL

List products

Returns a list of products.

Open fulfillment

Transitions a fulfillment from pending to open.

Open order

Opens an order.

Search customers

Returns a list of customers matching the search query.

Send account invite

Sends an account invite to a customer.

Send draft order invoice

Send an invoice for the draft order.

Update customer

Updates a new customer.

Update draft order

Update a draft order.

Update fulfillment

Updates a new fulfillment.

Update inventory item

Updates an existing inventory item.

Update inventory level

Updates a new inventory level of an inventory item at a single location.

Update metafield

Updates a metafield specified by ID

Update order

Updates an order.

Update product

Updates a product.

Update product variant

Update product variant. Please note that in order to use this operation, the variant options must already be defined on the product.