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

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.

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!