Automating a little bit

I’ve been selling some books on Amazon.com Marketplace. The listings are offered as a link from the product page for the book. People that follow that link seem to be selecting purely on price, so I don’t bother listing when the existing lowest price is too low for me to make money with my current packing material (a padded envelope). If someone buys a book from your listing, Amazon sends a “Sold, ship now” email with the listing ID and info, the buyer’s email and shipping addresses, and what kind of shipping to use. Amazon defines how much they charge (and give you) for “standard” or “expedited” shipping — in theory these amounts correlate with how much the USPS will charge for Media Mail or Priority Mail shipping (respectively).

For the first sale, I just took the book to the post office, bought an envelope there, filled it out by hand from the email, and included the packing slip from the email Amazon sends. The post office charges too much for the envelope, though, so my shipping cost was much more than Amazon gave me for shipping.

I went to Office Max and picked up some cheaper envelopes — my per-unit cost was still a little higher than I could have gotten but I didn’t want an inventory of a billion padded envelopes for shipping books I may not even sell. I made a Word document with a shipping label and packing slip on one sheet and used my paper cutter to cut them apart for use. I still had to manually cut and paste (and fix the formatting) into the Word doc and compose the “I shipped your book” mail by hand.

Yesterday, I finally took another step forward in the process. I wrote a Python script that takes a Amazon.com “Sold, ship now” email from the Windows clipboard, makes a PDF file with a packing slip/shipping label, and then opens the PDF file so I can check it and then print it. Then I made another script that also took the message from the clipboard but then updated the clipboard with a suitable message body for a “I shipped your book” email. After I stuck shortcuts to both of these on the Start menu I can copy the Sold message body and then easily make shipping sheet or a shipped email. Conveniently, two more books promptly sold today so I could bask in the tedium I had saved preparing to ship the books. No more fumbling with Word and no more manually editing the Sold email to compose the Shipped email.

The next step for my set of tools is probably something that combines my two scripts with a GUI that can look in my mailbox, find the Sold, ship now messages, and let me pick the one to print shipping info or send a shipped message to. Right now I label “prepared but not shipped” order messages with “Important” and shipped ones are unlabelled but have been replied to. My script could do both of those things so I can continue to see order info using the saved search in Thunderbird. I might give writing that GUI as a Thunderbird extension a shot. At that point the email-composing Python script would probably best be implemented as part of the extension. I was sufficiently particular about how the packing slip and shipping label looked that I’d probably continue to call that script to make the PDF for the shipping label.

The USPS actually has APIs for doing address verification and ZIP+4 lookup (as well as buying postage) but they required registering and approval to use and I don’t have enough volume to bother. It’s sort of too bad, too, because they seem to be nice APIs and it’d be cool to integrate that into my scripts.

I put off writing automation for anything (and thus put up with the cut/paste/manual tedium longer than I had to) because I envisioned this complete GUI app for managing the process as the first step in automation. That was too much work, so I never did it. This “small step” in automation lets me inch toward my goal saving a little tedium with each step.

Of course, few of the books I’ve been selling have netted enough money to really be worthwhile unless I count the fun of streamlining my sales operations as part of the value I’m getting. I also value knowing someone probably wants the books they’re buying and the freed shelf space. It’s a lot more personal than just dumping a pile of books at BookBuyers and seeing what they take.