Automation

Automate Shopify shipping with GSheets

My Role

Developer

Year

2021

00.-

Description

Qallo's co-founder came to me with an automation question: send all international orders to a new shipment company. Please.

01.-

Approach

Be time-efficient

Find fastest way to do it

I try to solve things at minimum cost for my clients, so first step is figuring out what the solution will look like.

Getting the Shopify data was easy, it's a super connected tool. So, what we needed to figure out was the Shipment company. What does their API look like? Do they have a Zapier connection? How can we communicate with it?

In this case it was an old, xml-based API, that didn't provide any connections. We needed a bit of custom code.
 

The very easy zap that connects Shopify with Google Sheets

With least amount of custom code

The first steps could be tackled with Zapier: create a zap that gets the orders from Shopify and stores them in a Google Sheet.

We can write a script in Google Sheets that runs every 15 minutes and checks if there's a new - international - order. If yes, send it to the shipment API and give us back a link to a PDF label to paste on our boxes.
 

Sheets with retuned labels

02.-

Complexities

The most complex parts of this automation:

Interpreting API requirements

Connecting from Google Apps Script to an external http service is piece of cake. The only difficulty was with the api documentation. It's pretty old and confusing and thus we had to run quite a few tests to see if the data we were sending was following their requirements, if all fields were given, etc.

Luckily, the shipment company had a super responsive technical account manager at our disposal.
 

confusing API documentation

The packages' weight calculation

The most interesting part for me was writing the part of the code that calculates the packages. A client of Qallo can order different products with different sizes, and there's an optimal way of putting them in the packages. So that optimal way, based on some images that I received from the Qallo team, had to be translated into an algorithm.

I love these little puzzles =)
 

A little algorithm for package calculation

03.-

Delivery

This was an easy 10 hour project. Qallo now has a sheet with all the labels that they need to paste on their packages, drop them off at the post office, and that's it!

the label we needed