In this Lob “how-to” blog post, I will be walking you through the simple process of configuring Lob webhooks and automatically capturing the information sent in a Google Sheets spreadsheet. Webhooks are an easy way to get notifications on events happening within Lob’s architecture.
Some common use cases for integrating webhooks are:
- Sending end-users notifications about mail traveling through the postal stream
- Receiving notifications about erroneous scan events, such as “Re-Routed” or “Returned to Sender”
- Downloading PDF previews or thumbnails automatically once they are rendered
- Internal logging and reconciliation
When an event occurs and you have a webhook subscribed to that event type, we will attempt to send the details for that event to the Zapier URL provided. Upon receipt, Zapier will take that information and create a new row in a Google Sheets spreadsheet.
First, we’ll create the spreadsheet in Google Sheets that will capture all of your pertinent webhook information for each event you subscribe to. You can download this CSV file, modify the header row with the fields relevant to your needs, and then upload the file to your Google Drive.
Next, we will create and configure the Zap that will capture the Lob webhook and create a new row with the information from the fields you’ve selected.
In the “Connect this app…” field, enter Webhooks by Zapier. In the “with this one!” field, enter Google Sheets.
In the “When this happens…” dropdown, select the Catch Hook trigger. In the “then do this!” dropdown, select the Create Spreadsheet Row trigger.
Click on Use Zap to proceed to the configuration.
Copy the Custom Webhook URL and click CONTINUE.
Before testing this app, go to your Lob Dashboard and navigate to the Webhooks page. Select Live Environment and click CREATE.
Enter a DESCRIPTION, paste the Zapier Custom Webhook URL in the URL field, and select which EVENT TYPES you would like to capture in your spreadsheet. Click CREATE.
Click DEBUGGER, select an EVENT TYPE from the dropdown you will be mapping your response fields to in the appropriate columns of the Google Sheets spreadsheet. Click SEND. At the bottom, you should see 200 OK in the WEBHOOK RESPONSE.
If you do not see 200 OK in the WEBHOOK RESPONSE, please check your Zapier Custom Webhook URL.
Return to Zapier and click TEST & CONTINUE.
Click CONTINUE. Select your Google Sheets account from the dropdown and click CONTINUE. (You may need to connect your Google account to Zapier.) Click CONTINUE.
Select your Drive, Spreadsheet, and Worksheet for the CSV file you uploaded earlier. You will notice that the elements in the spreadsheet’s header row will now appear as separate fields below.
Click and select the field from the Webhook response that you want to map to the corresponding column in the spreadsheet.
After you have completed mapping all of the Webhook response fields to their respective column headers, click TEST & CONTINUE.
Your Zap is now ready, so click TURN ZAP ON and open up the Google Sheets spreadsheet to ensure that all the data from the test response populated the correct columns.
For more information, please see the Zapier and Google documentation for these apps:
This article is intended to illustrate how these tools can be used together and is not a supported Lob feature. It was developed using the Zapier applications listed above. As products evolve, the Zap may need to be adjusted to continue working correctly.