Shopify with FTP

Export Shopify Sales Orders to FTP as XML or CSV files.

This tutorial will guide you through a simple Sales Order export from a Shopify system that results in a CSV file placed on an FTP server.

Prerequisites

This tutorial should be followed to create a Shopify to FTP integration in just a few quick steps. These steps assume that you have the following accounts and information to hand:

  • Shopify Store - An active Shopify or Shopify Plus store.

  • FTP or sFTP Account - A working FTP or sFTP server with the login information to hand.

  • HighCohesion Account - A HighCohesion account. (get one here)

Guide

All of the following steps should be taken in order. Unless specified the steps assume that you are logged in to the HighCohesion control panel.

1. Keys

The first step is to add the system account keys. The keys are what the HighCohesion system use to connect to the 3rd party system, for example API credentials or login details.

In the control panel click on the Keys link from the left navigation and then press the Add Key button located at the top right of the page.

The next page will be the create key form, you will need to enter the following settings before pressing save.

  • Title - A title for the key your creating, e.g. "FTP Key"

  • System - Select the system from the dropdown list, in this case "FTP"

  • Content - Add the following details to the credentials section:

    • host = Your FTP server URL

    • username = Your FTP server username

    • password = Your FTP server password

    • port = normally either 21 for FTP or 22 for sFTP

Once you have pressed save on the first create key form you will be returned to the list of existing keys. You'll need to press the Create Key link once more to add the Shopify key. For the link to work you will need to activate a "Private App" connection to Shopify. To do this, follow this guide.

  • Title - A title for the key your creating, e.g. "Shopify Key"

  • System - Select the system from the dropdown list, in this case "Shopify"

  • Content - Add the following details to the credentials section:

    • store = Your shopify URL, e.g. shopifystore.myshopify.com

    • api_key = Copied from the private app screen in Shopify.

    • password = Copied from the private app screen in Shopify.

    • shared_secret = Copied from the private app screen in Shopify.

2. Source

A source is where the data will be coming from. To create a source log in to Control Panel and select sources from the right side panel and select Create Source. To create a source you will need the following information below.

  • Title - Enter a title for the source, e.g. Get Shopify Orders

  • System - Select Shopify from the systems list.

  • Function - Select function from dropdown in this case GraphQL\GetOrders::fromShopify()

  • Key - Select the Shopify key that was created in step 1 above.

  • Trigger - Choose an option from the drop down list, either Manual, Scheduled or Web hook. For the purpose of the tutorial we are going to select "Manual", however after the smoke test in step 6 you may want to change this to scheduled.

  • Settings - Add the following setting so that the source will only collect orders created in the last 15 minutes that are marked as paid.

    filter_created_at-gt = "CURRENT-15 minutes"
    filter_financial_status = "paid"

For the scenario in this tutorial we are going to get sales order information from Shopify, however this could be any other information, such as Products, Customers, Transactions etc, these would just require a different Function / Settings.

Trigger options for source includes web hooks, manual and scheduled. If you choose scheduled you will need to set a scheduled time in the trigger option field. For scheduling options checkout this site https://crontab.guru/

3. Destination

The destination is where the data will be streamed to after it has been transformed. To create a destination log in to Control Panel and select Destinations from the right side panel and select Create Destination. To create a Destination you will need the following information:

  • Title - Enter a title for the destination, e.g FTP Orders CSV

  • System - Select FTP from the systems list.

  • Function - Select function from dropdown in this example PostFiles::toFtp()

  • Key - Select the FTP key that was created in step 1 above.

  • Trigger - From the dropdown list select "Real Time".

  • Settings - Add the following setting so that the destination function will create a CSV file. These settings will also determine the name of the CSV file. For more information on what settings are available, check this link to FTP System Settings.

formatting = "csv"
csv_file_headers = true
filename_padding = 8
filename_format = "ORDERS##INCREMENT##.csv"
remote_path = "/3pl_orders"

4. Transformation

The transformation file is required to translate data between the source system format and destination system format. To create a transformation file log in to Control Panel and select Transformations from the right side panel and select Create Private Transformation. The transformation creation screen gives the following inputs:

  • Title - A meaningful title e.g "Shopify x FTP CSV :: Sales Order Data"

  • Source - Choose the source system from the dropdown list, Shopify in this case.

  • Destination - Choose the destination system from the dropdown list, FTP in this case.

  • Primary Data Type - The data type will be what data is being streamed e.g order, product, payment etc... in this example the data type will be order.

  • Content - This will contain the mapping file which translate between the source and destination, for details on how to create a transformation file please check this link.

Information on how to create transformation files can be found in this Example Tutorial, additionally all transformation functions are details on the Writing a Transformation page.

5. Stream

Step five in the process is to configure the our data stream. The stream in HighCohesion terms is the part that brings all of the settings together in to an active integration. To set this up, select the Streams option from the left hand navigation. Then on the next page press the "Create Stream" button at the top right side of the page. On the next page, complete the following settings:

  • Title - Create a title for the stream: "[SO-1001] Shopify x FTP CSV for Sales Orders".

  • Description - Optional, e.g. "Shopify to FTP for sales orders."

  • Source - From the dropdown, select the destination "Get Shopify Orders", as created in step 2 above.

  • Transformation - from the dropdown select the private transformation file that was created in step 4 above.

  • Destination - From the dropdown, select the destination "FTP Orders CSV", as created in step 3 above.

  • Data Type - For the data type enter: sales_order

  • Active - Tick this option to activate the stream.

6. Smoke test

Depending on which source function was chosen for the source in your stream will depend on how you can smoke test the integration. In the example above we used GetSalesOrders::fromShopify(). Therefore in order to test this we would create a new Sales Order in the Shopify system. The sales order should then be collected by the integration, visible in the HighCohesion control panel (Events List) and visible as a file on the FTP server.

Summary

Congratulations, you are now setup and ready to enjoy a working Shopify x FTP integration.

Common Questions

Can I customise the attributes in the transformation files specific to my store? Yes! Follow this link to our guide about how to customise transformation files with specific examples.

What about the Shipment file coming back to my Shopify system? The shipment file being read back in to Shopify can be completed in part two of this tutorial. (Click Here)

Last updated