Segment is a platform that captures and stores all first-party customer data regarding your product or service in a centralized place. More specifically, Segment collects events from your interfaces (websites, web apps, etc.), and from that information, helps you create more personalized customer experiences across various channels.
We will plug Lob into our Segment flow by making a custom destination function. Destinations are business tools or apps to which you can send the data you collect in Segment. Depending on which mailpiece form factor you want to send (postcard, letter, etc.), building a destination function that sends it merely involves reading in the data and calling Lob’s API. These steps are outlined below.
Make sure you have a Lob account with your API keys. It is highly recommended that you use your (secret) test API key first.
Have a creative file ready to use (hosted PDF file or HTML template)
The following sample code translates Track events into Lob mailpieces by defining an onTrack function. (For other functionalities, just define a similarly named function, e.g., onPage for Page events.)
Remember to test your mail sent through Segment by using your test API key first. Once you do, plug in your live key, and enjoy sending intelligent, automated mail pieces with Lob and Segment!
Given how useful Segment is for integrating multiple different interfaces for collecting and operating on customer data, this tutorial gives us the ability to add Lob as one of many possible powerful tools for accomplishing data-driven, instantaneous operations on that data. Luckily, plugging Lob into Segment is as easy as making a destination function and using it in your workflows.
Here are two other resources that might help with crafting your workflow:
This blog provides general information and discussion about direct mail marketing and related subjects. The content provided in this blog ("Content”), should not be construed as and is not intended to constitute financial, legal or tax advice. You should seek the advice of professionals prior to acting upon any information contained in the Content. All Content is provided strictly “as is” and we make no warranty or representation of any kind regarding the Content.
Stay up-to-date with Lob’s latest
We have a lot cooking in the Lobster tank! Sign up for our newsletter to never miss a beat.