Skip to content

Lob

Lob.com is an online service that allows you to send direct mail to your users.

The Braze and Lob integration leverages Braze webhooks and the Lob API to send mail like letters, postcards, and checks through the mail.

Prerequisites

Requirement Description
Lob account A Lob account is required to take advantage of this partnership.
Lob API key You Lob API key can be found under the settings section under your name in the Lob dashboard.

Integration

Step 1: Select Lob endpoint

The HTTP URL to request in the webhook is different for each action you can make to Lob. In the following example, we use the postcards API endpoint https://api.lob.com/v1/postcards. Visit the complete endpoint list to select the endpoint appropriate for your use case.

API endpoint Available endpoints
https://api.lob.com/ /v1/addresses
/v1/addresses/{id}
/v1/verify
/v1/postcards
/v1/postcards/{id}
/v1/letter
/v1/letter/{id}
/v1/checks
/v1/checks/{id}
/v1/bank_accounts
/v1/bank_accounts/{id}
/v1/bank_accounts/{id}/verify
/v1/areas
/v1/areas/{id}
/v1/routes/{zip_code}
/v1/routes
/v1/countries
/v1/states

Step 2: Create your Braze webhook template

To create a Lob webhook template to use in future campaigns or Canvases, navigate to Templates > Webhook Templates in the Braze platform.

If you would like to make a one-off Lob webhook campaign or use an existing template, select Webhook in Braze when creating a new campaign.

In your new Webhook template, fill out the following fields:

  • Webhook URL: <LOB_API_ENDPOINT>
  • Request Body: Raw Text

Request headers and method

Lob requires an HTTP Header for authorization and an HTTP method. The following will already be included within the template as a key-value pair, but in the Settings tab, you must replace the <LOB_API_KEY> with your Lob API key. This key must include a “:” directly after the key and be encoded in base 64.

  • HTTP Method: POST
  • Request Headers:
    • Authorization: Basic <LOB_API_KEY>:
    • Content-Type: application/json

Request body code and webhook URL shown in the Braze webhook builder compose tab.

Request body

The following is an example request body for the Lob postcards endpoint. While this request body is provided in the base Lob template in Braze, if you wish to use other endpoints, you must adjust your Liquid fields accordingly.

1
2
3
4
5
6
7
8
9
10
"description": "Demo Postcard",
"to": {
    "name": "{{${first_name}}} {{${last_name}}}",
    "address_line1": "{{custom_attribute.${address_line1}}}",
    "address_city": "{{custom_attribute.${address_city}}}",
    "address_zip": "{{custom_attribute.${address_zip}}}",
    "address_country": "{{custom_attribute.${address_country}}}"
},
"front": "https://lob.com/postcardfront.pdf",
"back": "https://lob.com/postcardback.pdf"

Step 3: Preview your request

At this point, your campaign should be ready to test and send. Check the Lob dashboard and the Braze developer console error message logs if you run into errors. For example, the following error was caused by an incorrectly formatted authentication header.

A message error log showing the time, app name, channel, and error message. The error message includes the message alert and the status code.

HOW HELPFUL WAS THIS PAGE?
New Stuff!