Courtesy of smoothfluid

Courtesy of smoothfluid

I was looking at automated paper mailing systems recently (and listed what I found), and was especially impressed with Lob, especially the ease of its API.

Among other printing services, Lob will let you mail a postcard with a custom PDF on both sides, or a custom PDF on one side and a text message on the other, anywhere in the USA for $0.94.  (Sorry, not sure about international postcards) The company for which I work sends out tens of thousands of postcards every quarter. The vendor which we use charges them a similar fee (less, but in the same ballpark) but there’s a manual process to deliver the collateral and no API. So an on-demand, one by one post card sending system is very interesting to me.

Note that I haven’t received the Lob postcard which I sent myself, so I can’t speak to quality. Yet.

The Lob API is a bit weird, because the request is form encoded rather than a JSON payload.  It also uses basic auth, but only the username, not the password. But the API seems to have all the pieces you’d need to generate all kinds of postcards–reminder postcards, direct mail postcards, photo postcards, etc.

After testing out the service via the web interface and cURL examples, I thought that it’d be fun to build a Zapier zap. In particular, being able to send a postcard for an entry in a Google spreadsheet seemed like a useful use case. Plus, Zapier is awesome, and I’d wanted to test out their integration environment for myself.

So, I built a Zapier integration for Lob, using the Zapier developer docs in combination with the Lob developer docs. It was actually easy. The most complicated step was translating the Zapier action data, which is a one or two dimensional array of typed data, into the Lob data format, which wanted a couple of text fields and two address arrays. Zapier has a scripting environment that let me modify data from APIs pre and post send, and even had an example about form encoded APIs. Zapier’s JavaScript scripting development environment was full featured, including syntax and error highlighting. It had no real debugging available, but I could use the venerable debug-by-log-statement method fairly easily.

Where could I take this next? Everywhere people use postcards in real life. The postcards depend on PDF files (see a sample), so if you are generating a custom postcard for each interaction things become more complex, but there are a few APIs (based on a 30 second google search, here and here) available for dynamic PDF generation. There are also limits on API call throughput, if I stuck to the Zapier integration–I could send at most 300 postcards a day, unless I managed multiple spreadsheets.

I see reminders of high value events (dentist, house maintenance, etc), contests and marketing as key opportunities for this type of service. And if I had a product where direct mail was a key component, using Lob directly would be worth serious consideration.

Regarding the Zap, I believe I cannot make this Zap available to anyone else. Since I’m not a representative of Lob, I couldn’t commit to maintaining this Zap, and Zapier doesn’t want to have any of their customers depending on an integration that could disappear or be unsupported at any time–a fair position.

If the Zapier or Lob folks want to take this integration and run with it, I’d be happy to share my code–just leave a comment. If anyone else is interested in being able to generate Lob postcards from a Google spreadsheet (or any other compatible API) via Zapier integration, let me know and I’ll see what I can do.

12 thoughts on “Building an automated postcard mailing system with Lob and Zapier

  1. wade foster says:

    Hi Dan, this is awesome! Would be happy to make this public on Zapier. Shoot me an email?

  2. moore says:

    Great! I just sent you an email.

  3. Fred Arnaud-Meyer says:

    Great Post…Zapier is just one of the best swiss army knife i know…and lob is something i’m very exited to play with:)  thank you for your help:)

     

  4. Joey says:

    Best way to get this going is contact Lob as the zap is private. Lob sent me the invite, and I’m now getting ready to figure out the whole zap you built, thanks for taking the time to make it.

  5. Wade says:

    Hello,

    Did this ever get into zapier? I’m trying to do the same thing, except sending a letter through podio to lob. I can’t find any examples of the code anywhere. Can you please send your code to me? I really appreciate your time and any help that you can provide!

    Best,

    Wade

  6. moore says:

    Hi Wade,

    I’d reach out to the Lob folks directly–they took over the code I wrote. I’m not sure if it ever was turned into a supported Zap. Probably worth chatting with the Zapier folks as well to let them know of your interest.

    If you’re interested in hiring me as a consultant, please feel free to contact me.

    Cheers.

  7. moore says:

    Hi Joey,

    No problem. Glad to help. Please feel free to contact me if you’d like to hire me to finish it up or make any additional customizations.

  8. felipe says:

    Hi there! very good post. Anyone knows if exist a webpage like Lob in any country in Europe?

    Best.

  9. moore says:

    Sorry felipe, I don’t know about that.  You could contact lob and ask them, maybe.

  10. crystal says:

    Hi, I’m trying to create a website where visitors can create a postcard and my client prints and mails the postcards to the receiver.  Any knowledge on how to go about doing this without going thru a company like Lob?  My client doesn’t want to add extra costs to their postcard.

  11. moore says:

    Hi, if I were building such a system I’d look at ways to generate a pdf from user input. Not sure what you are using, but prawn works well with Rails and if you’re using php there appear to be several options.

    Not sure what kind of cardstock you’d need to print on, but I bet Google can help you there.

  12. crystal says:

    Hi Dan, thanks for the response.  I am using WordPress and am just learning what to do– I do understand what you said though lol.  I have known enough to know that using WordPress would be good, but it’s been a challenge too because of the blog-like atmosphere. I am doing this on behalf of a family friend, so details of cardstock I’m not sure.  Will figure this out somehow.  Thanks again.

Comments are closed.


© Moore Consulting, 2003-2017 +