FTP by Mesa

The FTP (File Transfer Protocol) App allows you to download and upload files to a specified FTP server. With Mesa, you can map the data to a format that Shopify or another system expects and pass it along to the next step. Sharing CSV and other files via FTP servers is a great choice to connect your fulfillment service, product manager, or other third-party system to Shopify.

Connecting FTP with Mesa

Your hosting service should have details for all of the fields required to create a FTP Credential.

Configuring

You can input your preferred name of the file that will be sent to your FTP server. 

Example: products/all-products-{{date:_m_d_Y_h_i_s_A}}.csv will create a file in the products folder, with the name all-products-_07_30_2021_09_48_54_AM.csv

For FTP App Triggers, you will be able to designate a specific time for the workflow to begin. 

Data Mapping

You can map out the data sent to your FTP server by utilizing Mesa's Tokens feature

Advanced Data Mapping

For more advanced mapping, you can also use the Edit Code button on the FTP action, then add in your own data mapping. The following code will take a list of Shopify products, and create CSV file content from them. The Mesa.csv.encode() method is used to convert the data into CSV format. See the Mesa Script SDK documentation for more details.

  script = (payload, context) => {

    // Adjust `payload` here to alter data before we transform it.

    // Alter the payload data based on our transform rules
    let csvRows = [];

    payload.forEach(product => {
      csvRows.push({
        id: product.id, 
        title: product.title, 
        handle: product.handle, 
        status: product.status
      });
    });

    // Adjust `output` here to alter data after we transform it.
    const csvOutput = Mesa.csv.encode(csvRows, true);

    // We're done, call the next step!
    Mesa.output.next(csvOutput);
  }