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 another third-party system to Shopify.
In the following sections, you will go over important topics regarding our FTP by MESA app.
Connect FTP with MESA
Your hosting service should have details for all of the fields required to create an FTP Credential.
Configuration
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 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 Variables 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); }