Company Blog Support
Frank Hagan
Updated

Contents

    Back to Top

    Integrating with Lob Using Zapier Webhooks

     

    About

    Zapier connects hundreds of web apps to each other in predefined integrations. Zapier also includes "webhooks", a way to send data from one application to another without having to use a predefined integration or API (Application Programming Interface). This article will show how to send Contact Record and your company information from ONTRAPORT to Lob, a popular postal mail application, using Zapier's built in webhook application. Our example will create a postcard quickly, without using the more complicated API a programmer might use. 

    Prerequisites
    Gathering Information For Your Webhook

    Start by determining what information from ONTRAPORT will be supplied to Zapier's webhook. Lob requires the "from" (your company information) and "to" (contact record) address fields you would expect for postal mail, and a URL for the image on the front of the postcard.

    Fields Required by Lob  
    • From Name
    • From Address
    • From City
    • From State
    • From Postal Code
    • From Country
    • To Name
    • To Address
    • To City
    • To State
    • To Postal Code
    • To Country
    • Image URL
    Creating the Webhook (or Ping URL)
    1. In Zapier, create a new Zap and select Zapier Webhook as the application for the first step. Select Catch Hook as the action for the webhook. In the next step, View Webhook, copy the Webhook URL in the to the clipboard for use in ONTRAPORT.

      Zapier Webhook

    2. Open ONTRAPORT in another tab, and create or edit a Campaign. Add a Send a Webhook element from the Advanced section of the strong>Add New Item dialog.
    3. Paste the Webhook URL into the Add the destination URL: element in the Webhook's Settings.
    4. In the Add the Post data to send box we will format the information to send to Zapier that will be sent to Lob. There are three components for each field that Lob will need, our label, an equals sign, and the ONTRAPORT merge field (or static text information). We will also need to use an ampersand (&) to specify that another field is coming in the data.
    5. Start with the first name field. We use our own label, to_first_name in the example below, add an equals sign and insert the ONTRAPORT merge field for [First Name].
    6. Add the last name field using an ampersand (&) to join the field to the first one, our label for the field, to_last_name, an equals sign and then the ONTRAPORT merge field for [Last Name]. Each of the address fields is added using an ampersand (&) to separate the field, the LOB label name, an equals sign, and the ONTRAPORT merge field:

      A Campaign Webhook element for Zapier
    7. When finished adding the other merge fields from ONTRAPORT to send to LOB, click Done and save and publish the campaign.
    8. Return to Zapier. Click Continue past the "Pick off a Child Key" step. The next step should let you test the webhook.
    9. Return to ONTRAPORT and add a test contact to your Campaign. The Webhook element should fire within a few minutes, and Zapier will record receiving the data.
    10. Click the view your hook link to see the data that was passed to Zapier.
    11. Alternate Method: Using a legacy Step Sequence with a Ping URL Rule Step:
      1. Open ONTRAPORT in another tab, and create a Step Sequence. Add a Rule Step and select Ping a URL under Then Do This.

        Ping a URL

      2.  Paste the Zapier Webhook URL from step 1 into the URL field. 

        Paste webhook URL


      3. In the Post Data box we will format the information to send to Zapier that will be sent to Lob. There are three components for each field that Lob will need, our label, an equals sign, and the ONTRAPORT merge field (or static text information). We will also need to use an ampersand (&) to specify that another field is coming in the data.

      4. Start with the first name field. We use our own label, to_first_name in the example below, add an equals sign and insert the ONTRAPORT merge field for [First Name]. 

        Add first field to post data box
      5. Add the last name field using an ampersand (&) to join the field to the first one, our label for the field, to_last_name, an equals sign and then the ONTRAPORT merge field for [Last Name].

        Add last name field
      6. Continue to build out the Post Data using this same format. You can include URLs as we have for the front_image Lob will use for our postcard front image, and specific text. In this example we have a URL to an image stored on Amazon S3 that is formatted according to Lob's specification for image formats at 1275px x 1875px (300 dpi). We put in our own "from" address information as just text. Note that you don't have to do anything special with URLs or the spaces, etc. in the text. 

        completed post data
      7. Save the Step Sequence.

      8. Return to Zapier. Click Continue past the "Pick off a Child Key" step. The next step should let you test the webhook.

      9. Return to ONTRAPORT and add a test contact to your Step Sequence. The Rule Step should fire within two minutes, and Zapier will record receiving the data. 

        webhook test successful!

      10. Click the view your hook link to see the data that was passed to Zapier.
    Configuring Lob to Receive the Webhook Data

    Now that we have received the Ping URL / Webhook data we can configure sending that data from Zapier to Lob.

    1. Select Lob in the Action step of the Zap, and select the option to Send Postcard

    2. Connect your Lob account, if required, and test the connection. 

    3. In the Edit Template step you can use the drop downs to select the data "caught" by the webhook. Zapier provides the label we used to describe the data, and shows us the sample data we sent in our test. 

      select fields

    4. When finished matching the fields, click Continue and Zapier will test the connection to Lob. 

    5. For testing, you can set Lob to the Test Environment and subscribe another test contact to the Step Sequence. Check under Postcards to see the results of the Ping URL / Zapier Webhook integration.

      Lob's text environment

    FAQs

    Q. Are there other ways to send a Ping URL to Zapier? I don't  want to use a Step Sequence. 

    A. Any place you can use a Rule you can use a Ping URL. That includes global Rules that wait for a trigger event, Rules on opt-in and order forms, Rule Steps in both Step and Date Sequences, Rules set up in the Collections / Recharge Settings, Rules configured during step 5 of the contact import process, etc.

    Q. Can I use a new custom field to store information, and then send that to a Zapier Webhook?

    A. Yes, any custom field you add will appear as an ONTRAPORT merge field in the drop down box. 

    Q. This "Ping URL" thingy looks a lot like a webhook. Why do you call it a Ping URL?

    A. ONTRAPORT pioneered the use of sending post data from an online business application to a URL over a decade ago. At that time the name of the feature was not set. In practice, a Ping URL and a webhook are the same thing.

    Q. What happens if an ONTRAPORT field does not have data in it? Is it just blank in the data sent to the Zapier Webhook? I don't want to send a postcard with the salutation "Dear ," 

    A. Yes, it will be blank unless you set up default merge field values. For instance, setting the default merge field value for the First Name field to "Valued Client" would result in the salutation being "Dear Valued Client," if the First Name field is blank.

     

    Articles in this section

    Created - Updated
    Have more questions? Submit a request

    Comments

    Powered by Zendesk