Lob's website experience is not optimized for Internet Explorer.
Please choose another browser.

Arrow Up to go to top of page
Hero Image for Lob Deep Dives Blog PostIncorporating Direct Mail into Customer.io Workflows
Tutorials
August 23, 2023

Incorporating Direct Mail into Customer.io Workflows

Share this post

Lob has a number of API integrations so you can add direct mail to your CRM, CDP, or marketing automation platform. Customer.io is a popular messaging automation platform that empowers its customers to create personalized message flows to engage their audience. Traditionally these have been channels like email and SMS. However, with Lob, you can bring direct mail into your omnichannel customer journey and manage it just as easily as your digital channels.

Getting Started

  1. Log into your Lob account. To start you’ll need your API keys. It is highly recommended that you use your (secret) test API key first for testing.
  2. Have a creative file (HTML template) ready to us .
  3. Sign into your Customer.io account.

Create a Campaign in Customer.io

We will be bringing Lob into Customer.io within the Workflow step of a Campaign. In order to set up a Workflow, you will need to first create the Campaign within Customer.io and configure your Trigger, Settings, and Goal & Exit steps. Complete instructions on this can be found in Customer.io’s documentation here.

screenshot

Setting up your Workflow

  1. Once you reach the workflow screen, you can begin crafting your customer journey by creating the event path your users will follow. Below is a standard example of an event trigger (User Purchase) followed by a standard Welcome Email.
screenshot
  1. We can incorporate Intelligent Mail into this Workflow in a similar manner to email by adding a Webhook node. We can do this by dragging in a Send And Receive Data tile from the left-side menu.
screenshot
screenshot

Configuring Your Webhook

  1. Now you will have an empty webhook, which you can configure by clicking to open it. This will open an edit screen in the left panel. You can find Customer.io documentation on webhook setup here.
screenshot
  1. You can configure it as follows:
  • Webhook Name: The Description of your Mail Event
  • Add Request: This is where we will add the Lob Endpoint URL and the  JSON code that will format the information being passed from Customer.io to Lob. More details on this below in ‘Configuring Your Webhook Request’
  • Sending Behavior: Send automatically

Configuring Your Webhook Request

  1. Click on Add Request to begin the setup process.
screenshot

screenshot

  1. Next to POST, you will construct the Lob endpoint URL for the type of resource you are trying to create. The format is as follows: https://+[YOUR LOB API KEY]+@api.lob.com/v1/[RESOURCE TYPE]
screenshot
  • Your API key will be either your Test or Live API key, which you can find in your Lob dashboard under Settings. It is strongly recommended that you begin with your Test API Key to ensure it is working, before switching to your Live API Key.
  • The Resource Type will depend on the mail format you are trying to send. For example, postcards, letters, or self_mailers. You can find all of the available resource types in Lob’s API documentation.
  1. In the black box, you will construct your JSON to pass the required information to Lob’s API to generate a mailpiece. For example, see Postcard > Create in Lob’s API documentation.
  1. You will pass in the Customer attributes to populate this by using Liquid Statements. This will enable to you not only pass in the recipient’s name and address, but also personalize your mailpiece by using Liquid to populate dynamic merge variables. (More information on creating personalized HTML templates.)

Below is example JSON you can test within your Customer.io webhook. Before testing this, replace the front and back with template IDs from your own Lob account.

{
   "description": "Customer.IO to Lob Postcard Creation",
   "to": {
       "name": "{{ customer.name}}",
       "address_line1": "{{ customer.address_line1 }}",
       "address_line2": " ",
       "address_city": "{{ customer.address_city }}",
       "address_state": "{{ customer.address_state }}",
       "address_zip": "{{ customer.address_zip }}",
       "address_country": "US"
   },
   "from": {
       "name": "Lob Solutions",
       "address_line1": "210 King St",
       "address_line2": "3rd Floor",
       "address_city": "San Francisco",
       "address_state": "CA",
       "address_zip": "94107",
       "address_country": "US"
   },
   "front": "tmpl_xxxxxxxxxxxx",
   "back": "tmpl_xxxxxxxxxxxx",
   "size": "6x9",
   "merge_variables": {
       "name": "{{ customer.first_name }}"
   },
   "metadata": {
       "source": "Customer.IO"
   }
}

Testing

Once your webhook has been configured, you will want to test it. Remember that you should be using your Test API Key for this, as you will otherwise generate live mail.

  1. You can send a test by opening up the Request and clicking on Send Test in the top right corner.
screenshot
  1. Once you confirm and send, you will want to see a 200 OK response in your Test Results. This will indicate that the request has successfully reached Lob.
screenshot
  1. You can also check the Test Results to ensure the request fields were correctly populated by the Liquid Statements.
  1. You can then log into your Lob account to verify that the mailipiece was successfully generated. Preview it to make sure all of the details are correct. If so, then you have successfully set up your Customer.io to Lob integration, and are ready to send Live Intelligent Mail.

Ingesting Mail Tracking Events from Lob into Customer.io

You can set up Webhooks within Lob to pass mail events (for example: Postcard Delivered) from Lob into Customer.io by using Customer.io’s Webhook Triggered Campaigns.

  1. Start by creating a new Campaign within Customer.io and select: Create Your Own Trigger From A Webhook as the trigger.
screenshot
  1. This will generate a URL to catch the webhook. Copy that to use within Lob in the next step.
screenshot
  1. Navigate to Webhooks within the Lob dashboard to set up the webhook event you want to capture.
  2. Under Create A New Webhook, enter a webhook description and paste in the URL generated by Customer.io.
  3. Finally, select the event you want to capture in Customer.io.

The integration between Customer.io and Lob is simple and easy to use. Businesses can create personalized direct mail campaigns using the same tools and workflows that they use for email and SMS; this makes it easy to manage their entire customer journey across all channels. The addition of direct mail to the omnichannel customer journey can be a powerful way to increase engagement and loyalty. By reaching customers in a more personal way, businesses can build stronger relationships and drive more sales.

More on Lob integrations.

Continue Reading