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:
Customize 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:
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.
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.
Explore why 1,100+ businesses trust their messaging to Customer.io.