Intro
In today's fast-paced world of software development, integrating your application with external APIs is virtually inevitable. However, each API comes with its own unique set of integration challenges. To maintain a clean and organized codebase, while also segregating the business logic of your application from the intricacies of third-party API interactions, consider the invaluable tool that is Saloon. This PHP package, compatible not only as a standalone solution but also as a seamless Laravel package, can help you architect your solution in an extensible and efficient manner.
If you want to know what are the advantages of using Saloon, you can read my article 5 reasons why you should use Saloon to connect to third party API. Now, assuming you're already acquainted with Saloon, let's delve into a real-world use case that beautifully illustrates how Saloon can transform your integration process in mere minutes.
The idea 💡
The story begins with my decision to use Beehiiv for my newsletter. Although I had no immediate plans to subscribe to their paid plan, I was drawn in by their attractive offering and the overall positive user experience. The prospect of having a customized widget on my website, giving me full control over the subscription box text, was particularly appealing.
Beehiiv offered APIs for adding subscribers, and that's where Saloon came into play. The integration process was smooth as silk. When a website visitor decided to subscribe, Next.js initiated a server-side call to my trusty Laravel application, the backbone of my blog. Like a well-oiled machine, Laravel took care of all the intricate communication with Beehiiv.
Every good thing comes to an end
However, the tide turned when my Beehiiv trial period came to a close. I must confess that Beehiiv's email notifications were nothing short of impressive. Just 24 hours before my trial expired, I received a comprehensive email outlining all the incredible features I'd be forfeiting if I chose not to continue with a paid plan. It was a wake-up call—I realized that I would no longer have the luxury of adding subscribers through their API.
But, like any developer worth their salt, I was undeterred and ready to find an alternative. After meticulous research and consideration, I decided to go with Mailchimp. With its renowned reputation, a generous free tier, and well-documented APIs, Mailchimp seemed like the perfect fit.
Without missing a beat, I set out to create a new connector that would seamlessly link my application with Mailchimp. Fortunately, Mailchimp's connector relied on a basic auth header, a feature that integrated seamlessly with Saloon, right at the connector level.