Customer.io

Incorporating Intelligent Mail into Customer.io Workflows

Overview

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 Intelligent 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 use.

  3. Sign in to 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.

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.

  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.

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.

  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.

  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]

  • 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.

  2. 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.)

Sample JSON

Below is sample 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.

  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.

  1. You can also check the Test Results to ensure the request fields were correctly populated by the Liquid Statements.

  2. 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.

  1. This will generate a URL to catch the webhook. Copy that to use within Lob in the next step.

  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.

  1. From here you can use the data on the incoming webhook to track as events or update attributes for users within Customer.io. This also enables you to trigger subsequent events—for example, you can imagine an omnichannel customer journey in which a customer receives a Lob postcard, and that automatically triggers an email to that same customer telling them to check their mailbox for a great offer.

Once you have incorporated both sending Lob mail and capturing Lob events within Customer.io, you will have truly automated direct mail, and integrated within your broader digital customer journeys.

Last updated