FlowRunner
Features Pricing
Theme
Start Free

Daily EasyPost label batch with postage refunds

Once a day, this flow refunds postage on cancelled orders, buys labels for every order marked Ready and sends the warehouse one EasyPost label file.

The prompt

Every day, go through our order sheet in Google Sheets. First, for each order marked Cancelled that already has an EasyPost shipment, ask EasyPost to refund the postage and mark the row Postage refund requested. Then, if any orders are marked Ready, start an EasyPost batch. For each ready order, get rates from our warehouse address, buy the cheapest label, add it to the batch, and write the shipment, carrier, postage, tracking number and label link to the row. If a label can't be bought, flag that row and move on. When every order is done, make one PDF label file for the batch, wait until it's ready, and post the link to our warehouse channel in Slack.

FlowRunner Prompt to Flow built this flow from that request. Here it is as it opens in the editor.

The flow

Yes Repeats for each item For each cancelledorder Repeats for each item For each order Repeats for each item Wait for the label file Condition Any orders ready? Action Find ordersready to ship Action Find cancelledorders Action Load the ship-fromaddress Action Start today'sbatch Action Make one labelfile for the batch Action Start the label check Action Send the label fileto the warehouse

Inside the loop: For each cancelled order

Yes Condition Label alreadybought? Action Mark the orderrefunded Action Refund thepostage

Inside the loop: For each order

Action Flag the order inthe sheet Action Get rates Action Buy the label If a step fails Label not bought Code Pick the cheapestrate Code Prepare the sheetupdate Action Add the label tothe batch Action Write the label tothe row

Inside the loop: Wait for the label file

Action Check the batch Action Give EasyPost 15seconds

Download the file, then in FlowRunner click + beside Flows, pick it under Import a Flow Version and click Create. How importing works

What each step does

  1. Find cancelled orders Finds every row in the order sheet with the status Cancelled. Rows without an EasyPost shipment have no postage to recover and are skipped.
  2. Refund the postage Asks EasyPost to refund the label and sets the row's status to Postage refund requested, so the same label is not refunded twice. The carrier confirms the refund later.
  3. Find orders ready to ship Finds every row with the status Ready. If there is nothing to ship today, the run ends here.
  4. Start today's batch Creates an EasyPost batch named for today's date.
  5. Buy the label For each ready order, creates the shipment from your warehouse, buys the label at the lowest rate EasyPost returns and adds it to the batch. An order that can't be rated or bought gets the status Label failed, and the rest carry on.
  6. Write the label to the row Writes the shipment ID, carrier, postage, tracking number and label link into the order's row. The shipment ID is what a later refund uses.
  7. Make one label file for the batch Asks EasyPost for one PDF with every label in the batch, and checks every 15 seconds until it is ready, for up to 10 minutes.
  8. Send the label file to the warehouse Posts the number of labels and the link to the label file in your warehouse channel in Slack.

Before you turn it on

  • Connect your Google and Slack accounts and enter your EasyPost API key.
  • Put your warehouse address ID from EasyPost, which starts with adr_, in the flow setting Ship-from address ID.
  • Pick your order spreadsheet and tab in the five Google Sheets steps. The flow reads the columns Status, Shipment, Name, Street, City, State, ZIP, Country, Weight in ounces, and Length, Width and Height in inches. It writes Status, Shipment, Carrier, Postage, Tracking and Label.
  • Pick your warehouse channel in the step Send the label file to the warehouse, then give the flow a daily schedule.