Zapier

Integration overview

Zapier gives you the ability to connect Lob to thousands of other business tools - like Slack, MailChimp, Gmail, and Trello - to automate your tedious workflows. In just minutes, you can set up automated Zaps to correct, standardize, and enrich addresses, as well as send automated letters or postcards using Triggers from pre-built integrations.

  • Zapier integrates Lob with thousands of other business applications

  • Set up automations, called 'Zaps', to automate repetitive tasks

  • No coding required

  • Sign up for a free Zapier account to create automated workflows

  • Zapier integrations are great for sending mail at small scale, instead of manually, but are not a replacement for a proper integration when sending mail in large batches (hundreds/thousands).

  • If you are passing in links to image files for your content, use a high availability service like S3 to avoid issues with timeouts. If we are unable to access your content it will not render properly.

Integration directions

Integrate with Zapier in 4 simple steps:

  1. Sign up for Lob and Zapier accounts

  2. Connect Lob to Zapier, within the Zapier interface

  3. Connect any other apps/services (for example, where you store customer data) to Zapier, in order to then connect them with Lob

  4. Create custom workflows or leverage popular automations with pre-existing Zaps

Every Zap requires one connected app to be used as the Trigger, which is where your information comes from, and this causes one or more Action steps to occur in other apps, which is where your data gets sent to.

Getting started with Lob & Zapier

Sign up for a free Lob account. You can send Test API requests for free to start, or instantly begin sending real mail by simply adding a payment method to your account.

Sign up for a free Zapier account, where you will begin building the automation.

Connecting Lob to Zapier

  • Log in to your Lob Account

  • Log in to your Zapier account

  • Navigate to "Connected Accounts" from the top menu bar in Zapier

  • Now click on "Connect new account" and search for "Lob"

  • Use your Test Lob API Key to connect your Lob account to Zapier

    • Start with your Test API Key so that you can set up and test your Zap without sending live mail initially.

  • Once connected, you can start creating an Automation! Use a pre-made Zap, or create your own with the Zap Editor.

  • Need inspiration? See everything that's possible with Lob and Zapier

  • Once you've tested your first Zap, all that is needed is switch your Lob API key to the Live Key to begin sending actual mail!

Getting started with Zapier

To help you hit the ground running, you can choose from one of many popular pre-made Zaps:

Sending postcards with Google Sheets & Zapier

Use Lob’s Zapier integration to automatically send postcards whenever new users are added to your mailing list.

Before starting, make sure to open accounts with Lob + Google + Zapier before starting to create this automation. Here, we will be using a Google Sheets file as our existing mailing list. This kind of setup significantly reduces the amount of manual work needed to send out mail and can be generalized for a number of different situations.

Stage 1: Setting up Google Sheets as your Trigger event in Zapier

  1. From the Zapier home screen, click on a “Make a Zap!” button to get started

  2. Select Google Sheets in the dropdown of available Trigger Apps, then Choose Trigger: “New Spreadsheet Row”

    • This means whenever a new row is created in our Google Sheet, Zapier will take an action on your behalf

  3. Connect your Google account to Zapier and give Zapier access to the account

  4. Once your account is connected, test out the connection using the “Test” option. If the connection works you will see the grey “Test” box turn into a green “Success!” box.

  5. Pick a spreadsheet + worksheet to pull information from

    • As this is the starting point for your automation, make sure that the correct information is being pulled

  6. Once a spreadsheet and a worksheet are selected, Zapier will pick a sample row. If the information accurately reflects what is found on the sheet, select the “Continue” option.

  7. In the next stage, you will configure the action you want Zapier to take after your trigger is initiated.

Stage 2: Setting up your Action

  1. Continue to build your Zap by clicking on the blue “Your Zap currently lacks an Action step. Add one now!” text. Alternatively, you can also click on the “+ Add a Step” button on the left side of your screen.

  2. Select Lob to be your Action App.

  3. Select “Send Postcard” as the action Lob will take after the Zap is initiated by the Trigger.

  4. Connect your Lob account to Zapier and give Zapier access to the account, so it can take action on your behalf.

  5. Once connected, you may receive a pop-up instructing you to verify this request by entering your Lob API key.

    • Use your Lob Test API Key; any requests sent with your Test API key will not cause mail to be sent or charges to be incurred. Once the integration is working, you can return to this step and swap in your Live API Key.

  6. Once the API key is passed, you will have the option to test the connection. If you click the “Test” button on the right and everything is valid, then you will see a green “Success!” button.

  7. Fill in the appropriate information needed to complete your mail. Note that some fields are optional and others are required.

    1. The green “Setup Preview” icon allows you to see an example of what your named variable would look like in your Zap. If you do not enable it you will not see an example.

    2. Be sure to you prepare your content images correctly. For this example, we are inserting HTML of the artwork directly into Zapier for both front and back sides of the postcard.

      • For more information on how to properly set your mail content for Zapier/Lob, see here. Example HTML templates can be found in our Template Gallery.

      • Alternatively, provide a link to a hosted PDF, PNG, or JPG file

    3. Add the address that will receive this postcard.

      • We’re going to use Zapier’s named variables function here; this time on the Address.

      • By using the named variable function, Zapier will pull the corresponding information for me every time a new entry is added to the Google Sheet.

    4. Lob defaults to USPS First Class Mail (a faster option), but Standard Class mail is also an option.

Stage 3: Test the Zap to Confirm

  1. Test the entire Zap (From Trigger to Action) by clicking on the "Send Test to Lob" button.

  2. Zapier will run a test, and once it runs through successfully you will be notified at the top of the page. An additional alert will tell you how long it’s been since the test was successful.

  3. Formally name your Zap and turn it on. If the Zap is not on, then Zapier will not execute against the workflow you set up in Stages 1 + 2).

Setting up webhooks with Zapier

With Lob you are able to track each step of a mailpiece's journey from production through to delivery. In addition to making these metrics available in the platform, Lob offers webhooks for each event, allowing you to listen to these events and pull this event data back into your own systems. With Zapier, the process is as follows:

  • Lob sends out a webhook when the mailing gets created

  • Zapier "catches" the webhook notification

  • Zapier notifies you that the mailer was created, scanned, delivered, etc.

Webhooks by Zapier can be configured if you have a premium subscription with Zapier. There’s no native integration for outgoing webhooks to Zapier, but there’s a way to catch these events using a generic webhook configuration. You can learn more about Webhooks by Zapier integrations and all the apps that are available for use.

In this example, we will set up a Zap to automate the following: every time Lob sends a new event for your mailpieces—and Zapier receives (the Trigger), Zapier will send you an email notification via Gmail (the Action).

  1. Start by clicking “Create Zap” on the homepage.

2. First you will Next, select the option “Webhooks by Zapier.”

3. Under “Choose app & event,” select “Catch Hook” from the “Event” dropdown options and hit continue. This is what starts the Zap.

On the “Set up trigger” screen that follows, hit “Continue.”

4. A URL will be generated, which you will need to configure with Lob.

When an event occurs within Lob architecture and you have a webhook subscribed to that event type in that environment (Test vs. Live), we will attempt to make a POST request with the entire event object to the URL provided.

5. Copy the Webhook URL then login to your Lob dashboard; on the Webhooks page, click “Create a new webhook.” Name your webhook, then paste the URL provided by Zapier into the “URL” field.

Then choose the EVENT TYPES you want sent. Due to the inherent limitations of Zapier, we advise selecting from one form factor (postcards, letters, etc.) per Zapier integration. See here for a full list of all available event types that you can subscribe to.

In Live mode, you can only have as many (non-deleted) webhooks as allotted in your current Print & Mail Edition. There is no limit in Test mode.

6. Now click the “Debugger” button on the top right-hand side corner.

The Debugger allows you to trigger webhook attempts to a specified URL with a generated event body. This should mainly be used to determine JSON structure, as all IDs and URLs within the event bodies sent are not real.

Select one EVENT TYPE from the dropdown options, and click “Send.” You should receive a 200 OK response.

7. Now go back to Zapier. Test the connection by clicking “Test trigger.”

8. You should see your event. Click “Continue.”

9. Now select which integration/app you want to Action on. Here we selected “Gmail” to receive event notifications for each mailpiece via email. Select “Send Email” and hit “Continue” to connect your Google account to Zap.

10. Fill in the required fields, and for the ones you would like to map the Lob webhook events to, click the field, select “Show all Options,” and select the option of your choice.

In this example, we want to receive notifications for the event_ID, date and time when this event gets created, and the sender's information on the postcard. Note this will be redacted as this contains Personal Identifiable Information (PII). You can choose any of the fields from the available options that you would like to receive notifications about based on your preferences.

Fill out the rest of the fields where you’d like to receive these webhook notifications, review the contents, and you’re almost done! Select “Publish Zap.”

You should receive an email with the webhook events that you selected.

The last thing needed is to Name your Zap (if you haven’t done so already) and to “Turn on Zap.” If the Zap is not on, then Zapier will not execute against the workflow you set up (Trigger to Action).

11. If all the steps are set up correctly, then you should receive a green checkmark on both “Trigger” and “Action.”

If Zap failed to create, then you will receive a message on where to fix the issue and an additional message regarding the error. Here’s a link to the HTTP status codes that the API would return in case of an error that may help in troubleshooting.

Adding merge fields

To integrate merge variables on Zapier, you would need to paste the full HTML string directly into the text box, then use the built-in merge functionality from Zapier to insert variable content. This is an example of what that might look like:

Watch the screencast above for more context.

Support information

Feel free to email contact@zapier.com for issues on the Zapier side, or support@lob.com for Lob-specific debugging!

Last updated