Hack to the Future: A Recap
Tags: hackathon, showdev
Published: 2022-05-06 22:05:52

At the rate [Lob](https://www.lob.com/developers) is growing our teams might not always make time to be creative or focus on something outside the roadmap. So twice a year, we force them to. Just kidding, our internal hackathon is always optional, but we certainly encourage all employees to participate, engineers and non-engineers alike. We believe hackathons are an opportunity to be inventive and do something outside the normal routine. As a company we want to embody one of our [core values](https://www.lob.com/blog/core-values) “Be Bold” and we encourage folks to push the envelope, pun intended (cuz you know, Lob plays in the direct mail space). 

We also wanted to have a little fun with a theme and chose [Back to the Future](https://www.youtube.com/watch?v=uduqQYfJ0_w) as our inspiration. This classic 80s movie series has stood the test of time and is a “totally awesome” representation of technology and innovation—like hoverboards and self-lacing sneakers—and the 80s! In addition to themed messaging (including Marty and Doc emojis in Slack) we had two project tracks:

**Time Travel is Real:** These projects deal with time, dates, or time-series data in some way. This includes time saving productivity hacks.

**Roads? Where we’re going, we don’t need roads:** Go off the beaten path (anything goes!) and turn Lob into a flying Delorean with your idea.

![dashboard inside delorean](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d60vir4ftu2h0qsoqkn6.gif)

![delorean](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rkcmmqz27i5rtfyybz2a.jpeg)

Our teams had just over 36 hours to tackle their projects, then they were asked to give a 5-minute presentation/demo.  In typical hackathon-style, there was a last-minute scramble and some finger crossing. As our first presenter noted, “like a normal software engineer, I'm just not ready just yet. So, I'm going to do my best to just wing it from here.”

## Eliminate repeating fixture data 

In order to address the problem of repeating fixture data when writing tests for our api (the center of our universe), Karmbir Chima created tooling to provide a pre-bundled set of fixture data that can be stitched together and inserted into our testing database. Eliminating the dupes means better tests (“less lines of code mean fewer places for bugs to hide”) and the new process overall helps automate a very manual process, saving time. Doc Brown would approve of this productivity hack. 

## Improve account management

Myrtle Tzouma, Shanna Murry, Makeda Davis, Mocha Brown, and Hanqing Chen teamed up to tackle a customer service/billing challenge. Lob uses an internal dashboard called Lens for customer account management. If a user needs to remove a payment method on an account, there's not an easy way to do it in the UI. The payment method must be removed from the Stripe dashboard, and from our dashboard with a manual POST request (Postman). Adding a small trash can icon—and associated functionality—is never as easy as it seems. The team had to touch three repos to make it happen. But the result is the ability to easily remove payment methods in fewer and less complex steps, saving not only customer service, but also engineers (who frequently test in the dashboard/API) time and effort. While not as cool as [Mr.Fusion](https://en.wikipedia.org/wiki/DeLorean_time_machine#Mr._Fusion), it’s a pretty useful little trash can.  

## Answers at your fingertips

The Address Verification team at Lob has found themselves answering some of the same questions over and over again in our internal Slack channel, asked by the team at large, and most often the on-call engineers. With arguably one of the best team names—FAQ to the Future—engineering manager Sherman Gore built a Slack bot to solve this problem.  Built in Node.js and hosted by [Glitch](https://glitch.com/), the bot will answer the question and supply supporting documentation. 

## Capacity management

Some days we have welcome, but unpredictable, volume surges; as Lob continues to grow we must ensure these don’t stress our [print partner network](https://www.lob.com/print-partner), or put our mail speed in jeopardy. What is currently a very tedious and manual process (think a flurry of phone calls) is moving towards automation thanks to Dave Krawczuk, Trent Blackwell, Anisha Biswaray, Michael Morgan, and Michael Tuffley. This team began the development of an environment for our print partners to be able to capture (and execute) additional volume. They demonstrated a portal that would show all mailpieces available (i.e. overflow not automatically routed by current logic in place), and a partner could claim them should they have additional ([flux](https://www.youtube.com/watch?v=VcZe8_RZO8c)) capacity. 

![flux capacitor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4cs2qgjp5zogjrp06c6.jpeg)

## A new application for machine learning

During peak volume days, USPS congestion causes delayed mail pieces, putting our target delivery dates at risk. Team “Hack the Mailman” (Aditi Ramaswamy, Anisha Biswaray, and Luke Birdeau) came up with a creative solution. Their goal was to create a model that can identify patterns of congestion within Nation Distribution Centers ([NDCs](https://pe.usps.com/archive/html/dmmarchive20100607/l601.htm)), and route mail to the fastest (or non-congested) NDC for more reliable and predictable service. This will allow us to better handle seasonality, and enhance logistic management with drop shipping. 

We love the USPS, but as with any large entity, they are not immune to challenges; USPS tracking data can be a bit spotty. But with enough data and a little intelligence, we could fill in the gaps….and possibly predict the future. In summary, tracking data (500K unique data points) was retrieved from our historical data then after a lot of data wrangling, was fed into [sklearn Random Forest regression](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.html). Then, it entered an ML flow invoked with a REST API call to allow for routing engine augmentation. 

When all was said and done, the test data showed the closest partner isn't always the fastest partner, and the ML model can help Lob improve our routing. We are excited to expand the project and will only learn more from more data. Much like the [Lob Confidence Score](https://www.lob.com/blog/lob-confidence-score) enhances our Address Verification API, so does this model for our routing engine. Given the potential positive impact on Lob’s operations (and that data from the past is being used to help predict the future), this team earned second place overall. They also deserve a shout out for their use of memes. 

![a mailman is never late nor is he early, he arrives precisely when he means to](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o9mnq0459ikmswz10np9.jpeg)

![usps tracking, I do not think that word means what you think it means](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1itjgcfjbhkc7rmlsdxe.jpeg)

## A new InDesign extension

An estimated 90% of our enterprise customers are using InDesign to create PDFs of their mailpieces (to send on to our print partners). Built as an [MXI](https://helpx.adobe.com/extension-manager/kb/general-mxi-elements.html), Heath Horton on our Rendering/PDF Pipeline team developed a Lob extension for InDesign—a ZXP featuring easy-to-use templates—that once fleshed out, will be available on [Adobe Exchange](https://exchange.adobe.com/creativecloud). 

## AsyncAPI

Gabriel Gore, Sachin Muralidhara, and Sean McGovern taught us a little more about  [AsyncAPI](https://www.asyncapi.com/) , an open-source specification for event-driven architectures (EDA).  It defines interfaces for Async APIs, similar to what OpenAPI or Swagger does for RESTful services. You can automate and formalize docs, you can generate code, you can validate schemas for event-driven microservices, and it's compatible with OpenAPI for a lot of use cases. (If you have an existing code base with Open API schemas in it, you may be able to port those over to AsyncAPI; here’s a nifty [comparison chart](https://www.asyncapi.com/docs/getting-started/coming-from-openapi).)

The team used AsyncAPI to begin building a spec for events within Lob’s Campaigns product (a new product in beta to allow enterprise marketers to send direct mail at scale). This yields two benefits; both improve developer productivity. The first and most obvious is an easily-accessible API spec. The second is improved testing as a result of having a simple and scalable way to validate messages on either side of the broker. (The example given was running into issues where you’re writing a function that pulls off an SQSQ but have no idea what's actually on the message payload because there's no contract to reference.)

Given the newness of AsyncAPI there is not yet a lot of[ tooling](https://www.asyncapi.com/docs/community/tooling) available, and the SQS protocol bindings are still in development, so the team used a lightweight loT protocol called [mqtt](https://mqtt.org/) for proof-of-concept. Despite these challenges, the team was able to demonstrate success to an excited audience; this could have some very positive implications for development in a number of use cases at Lob. 

![doc brown](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fmm2oq2mi0cwbhx036wp.jpeg)

## Lob QR codes 

Lob knows the value of [hyper-personalized direct mail](https://www.lob.com/blog/5-personalized-direct-mail-examples) and our templates are designed to accommodate QR codes as part of this strategy. However, we’ve relied on the customers or outside providers to supply these…Until now.  A small enterprising team of hackers decided to tackle this in-house and managed to build out end-to-end functionality for integrating QR codes into a campaign—and in doing so secured first prize. Congratulations to Muhammad Martinez, Samkit Sheth, Pat Thulen, Vishal Mangwani, and David Xu.

Showing off the backend, they demonstrated via Postman how one could input information like destination URL and number of mailpieces to create a campaign, for which Lob will then generate a unique QR code. Created as just another merge_variable (a dynamic field that can be updated within a mailpiece template) these codes will appear on each mailpiece rendered. When each QR is scanned it maps back to the campaign, providing analytics about each mailpiece (including the time and location of each scan) along with aggregate data about the campaign. So not only can Lob automate direct mail, it can now help measure its effectiveness. Great Scott! 

## Playing with livebook

Our resident Elixir SME, Guy Argo, worked with [livebook](https://github.com/livebook-dev/livebook) (similar to [Jupyter notebooks](https://jupyter.org/)) to allow dynamic exploration of Lob’s [Address Verification API](https://docs.lob.com/#tag/US-Verifications). Or in other words, created animated maps that you could interact with; the example was following a car across town. A future application of this at Lob could include tracing the journey of a mailpiece as it makes its way from printer to mailbox. (Or tracking the Delorean as it travels back in time?)

![delorean fire tire tracks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58rrc9lxbxzn2qolxgzn.jpeg)

## Bring your own SQL

In a [previous hackathon](https://www.lob.com/blog/hackathon-time-at-lob), data analyst Chris Migirdic built an IDE where you present your own time series data/problem, and a layer could be provided over it to make time-series predictions. This iteration was quickly dubbed “BYOSQL,” or Bring Your Own SQL, by participants as he explained one could write any SQL query against Lob’s data warehouse, and you'd be able to fit a time series model over that. The most obvious application for Lob is evaluating mailpiece data. Another improvement over the previous version was performance; much of this was attributed to a shift to deployment in [Nomad](https://www.nomadproject.io/). Finally, another benefit of the program is to pick up what kinds of queries people are running and get an idea of what prediction problems our developers are trying to solve. 

## SFTP to the future

Solutions Engineer Sam Melero has noticed a trend amongst our enterprise customers: their technical teams are the likely beneficiaries of investment in the latest tools and technology (the future), while the marketing teams may not (and are stuck in the past). For example, in the world of marketing automation, secure file transfer protocol (SFTP) is still a fairly common communication method. This may seem like a mismatch with an API-first company like Lob, but we are able to successfully onboard these customers as-is, and we support them as they transition. 

Anything we can do to support our customers as they transition to API benefits both parties. The goal of this project was to modernize STFP to work more efficiently with Lob’s existing architecture/processes.  AWS technology stack was utilized to achieve these improvements including [CloudFormation template](https://aws.amazon.com/cloudformation/resources/templates/), [Secrets Manager](https://aws.amazon.com/secrets-manager/), and Identity and Access Management ([IAM](https://aws.amazon.com/iam/))—with lots of Lambda functions in the mix. In short, this allows the user to log in more easily and securely to upload their creative to Lob, and have the same experience as an API user. (For example, API requests will be visible in the dashboard along with the appropriate analytics.) 

## Automating alerts

Ken Pflum, an engineer who works with our print partners, has been frustrated by the number of alerts coming in as many of them require manual intervention—and he had a suspicion that wasn’t always necessary. Thus the birth of the Automat, which is in essence, a webhook handler and runbook automator (tools/technology utilized included  [Datadog](https://www.datadoghq.com/) and open-source [Redis](https://redis.io/)). Upon alert, a webhook gets sent into the service, which can then trigger a designated workflow. For the proof of concept, the example was to automatically send an email to the partner from the alert. A small step, but definitely one in the right direction since that is a manual process right now. (Besides, it could be dangerous to move too fast. “If my calculations are correct, when this baby hits 88 miles per hour, you're gonna see some serious sh*t.”)

It’s pretty amazing what can be done with a little focus time. After all, per Marty McFly, “If you put your mind to it, you can accomplish anything!” And speaking of Marty, I’ll let him take us out:

{% embed https://www.youtube.com/watch?v=S1i5coU-0_Q %}