Artisan IMG > Shopify (shopify) (e38627ee-1330-4cbf-a2ab-1ed52219768e)
Artisan IMG > Shopify (shopify) (e38627ee-1330-4cbf-a2ab-1ed52219768e)

Shopify
6.0

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

Overview
Copy

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

API Information
Copy

The Shopify connector has the following Base URL: https://${params['#auth'].shop}.myshopify.com/admin/api/. More information can be found on their main API documentation (version: 2022-07) site. Details regarding their API limitations can be found here.

Authentication
Copy

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.

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.

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 the corresponding permission scopes else this will not authenticate properly!

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.

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
Copy

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.

Trigger operations available:
Copy

  • GDPR Webhook

  • Webhook

Webhook Setup
Copy

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.

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.

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

As of v2.3 the Shopify Trigger uses the same OAuth authentication method as the standard Shopify connector.

Follow the instructions above in the connector 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:

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
Copy

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:

> 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.

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 pages on Basic data concepts and Mapping data between steps

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.

2 - Add a Slack notification
Copy

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.

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, be sure to check out some of our key articles such as:

Notes for Embedded customers
Copy

Custom OAuth apps
Copy

You can create a custom OAuth app in order to White-label your authentications dialog in during your integrations.

Simply follow the steps outlined below:

Scopes
Copy

Please be aware of the following points when dealing with scopes while using an Embedded account:

  • The scopes you use for your source / master workflow are the scopes that your end users will have when creating the auth.

  • You can also override scopes in the solution editor. This will allow you to specify that only a subset of the scopes set in the master workflow are available to your End Users. Please reach out to your Tray technical support if you wish to activate this feature.

  • When creating an OAuth app in the Shopify UI, you shouldn't set granular scopes. This way, you would have to create a custom OAuth app for every integration that you create for this service to enforce scope limitation.

    • A better way would be to use the standard method of setting the scopes when you are creating an authentication in your source / master workflow for each Solution. This way you can have multiple integrations that use the same custom OAuth app and control them within Tray.