Mail a postcard with Lob

Website: http://lob.com API Docs: https://lob.com/services/postcards

Lob is an API to send physical mail. You can connect Customer.io to Lob using Webhook Actions to send a postcard, letter, or even send a check. In our example, we’re going to trigger a postcard to be sent to customers when they’ve been a subscriber for 3 months.

Show me how!

The finished product:

Start mailing Lob postcards with Customer.io

Get your Lob API key

If you don’t have a Lob account, start by creating one over at Lob.com. In your Lob account, you’ll want the API Key from your account. We recommend starting with your “Test API Key” from your settings.

Create your campaign

Create a campaign in Customer.io where you want to add the webhook action. For our example, we’re using a segment triggered campaign with the segment “Paid 3 times” as our trigger.




Add your webhook action to the workflow

Add a new webhook action in the campaign’s workflow, and give it a name. Then click Add Request.

You'll then be brought to the Webhook composer.

Add your webhook headers

Next to POST, add in the API key and the postcard API endpoint in this format:

https://[API-KEY]:@api.lob.com/v1/postcards, so the API key followed by a colon : and an @ sign.

Note: If you’re trying to send a letter or a check, more endpoints are in the Lob documentation.

Your headers should look something like:

Customise your postcard

Copy and paste this example code in to the content area for your webhook.

You’ll want to adjust the liquid for mailing addresses to match your custom attribute names in Customer.io.

For details on customizing the front or back of the postcard, take a look at Lob’s documentation.

When you’re done, you’ll have a finished webhook that looks something like:

Send Request

When you’re ready to test, you can click Send Request. Customer.io will show you the response from the Lob API.

If you’re successful, you’ll see a 200 OK.

Success!

In Lob, you should now see your postcard successfully created.

We’re excited to hear how you end up using Lob with Customer.io’s Webhook Action. If you have any trouble, let us know! We're happy to help.