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 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 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.
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
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:
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:
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.
In Lob, you should now see your postcard successfully created.
Conversions in Customer.io are credited to the last message sent before a person enters or leaves a segment. Webhooks work a little differently. We give you the option to enable conversion tracking just on the webhook actions you chose. For this campaign, we recommend enabling conversions for this webhook, since it triggers a customer-facing message.
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.