Just-in-time Shipping: How Yerdle Uses EasyPost
by Jarrett Streebin
This post is by Carl Tashian, developer and co-founder at <i>yerdle.</i>opens in new tab Yerdle built a very cool EasyPost integration that allows them to get labels to their members in minutes rather than days. We've republished <i>his original post below.</i>opens in new tab
When people win items on yerdle, they can opt to pay for shipping. We ship quite a few things out of yerdle HQ, and our members ship a lot more things to each other.
Last week we discovered our process needed a redesign. What works at a small scale always needs a rethink (or several) as you scale.
So we took 20 minutes to redesign the process. We sketched the current process and the new process on stickies.
The Old Process
For each item, we would:
- dig up the Amazon Payments confirmation e-mail for the item
- copy the address from this e-mail and paste it into the FedEx ship manager website
- if the label is for an item that we have at HQ, print it out
- otherwise send the label to the giver in an e-mail
- also send a confirmation to the winner
There were also several hand-offs along the way between people, which of course always slows things down.
We quickly realized that the label generation piece was a big bottleneck. When a winner pays for shipping, the giver should simply receive a shipping label right away.
Integrating EasyPost was really straightforward. We built an adapter to convert Amazon's payment callback data into an
EasyPost::Address, and we created a
ShipmentWorker for Sidekiq that would grab the label and e-mail out confirmations to both parties, or queue it up to be printed at the office (for yerdle HQ items). And finally, we put together an admin panel for our ops team.
The build took about a day and a half, but we had to wait a couple more days before we could deploy it. The hurdle was that FedEx has a Big Company way of getting accounts approved for their API, so we had to go through a formal Certification Process that took a couple days. But once we got approved and flipped the switch, the e-mails started flowing and we haven't looked back.
The next step was to get labels printing at HQ for our ops team.
Enter the Zebra
The Zebra ZP450 thermal label printer. This thing has an RS-232 port. It has a parallel port! And, thankfully, it has a USB port.
One challenge: How would we get the shipments out of our Rails backend and to the Zebra on a Mac Mini, on-demand? We could have built a new API endpoint and polled for new shipments, but this seemed like the perfect use case for a pub/sub model. I wanted to say something like
Shipment.first.print and have a label pop out of the printer.