Klipfolio API Helper: Adding a Little Efficiency to a Laborious Process

Stacie Taylor-Cima
Jul 17, 2018 · 4 min read

Klipfolio API Helper is a tool built by Stacie Taylor-Cima to create a bulk number of custom clients by interacting with the Klipfolio API. Read on to learn more about why the project was built and how it contributed to the completion of a very large project.

Klipfolio API Helper on Github

Mission

Over the last 5 years, I have been working alongside a brilliant team to build a social media agency. When it comes to offering our clients reports we have tried everything from piecing together our own reports manually, to having our developers build reports, to working with external reporting companies. Our most recent partnership wasn’t progressing as fluidly as we’d hoped it would, so we decided to switch to Klipfolio.

Switching reporting tools is a huge project with many moving pieces. As I was working with the Klipfolio team, I realized setting up our clients was going to be a very laborious process. They suggested that the best way to speed up the process was writing a script to set up the portals. They’re team is incredibly helpful, but coding scripts isn’t their expertise and this wasn’t something they were able to support me in creating.

At first, I was really disappointed that the process was so time consuming and there wasn’t a whole lot they could do to make it simpler for us. But then I thought, “Wait! I know how to code!” So, I set out to build a script that would automate as much of the process as possible.


How it was built

My goal was to create this script in the simplest way possible. I prefer to code in Ruby and this was a perfect application of the language.

Plan the Project:

I started by thinking through what the script should do.

  • It should loop through a csv that includes my client’s name, Facebook ID, and Twitter handle
  • It should create each client in Klipfolio
  • It should customize all of the attributes we need our client’s portals to include

Then I moved on to building the skeleton of the project. In an effort to keep the project very simple, I created a the project to include the script, a Gemfile, and the csv.

Initialize & Authenticate

The script is built within a Ruby class named client. I’ve required the HTTParty gem and JSON gem so that I can send requests to the Klipfolio API in the proper format. Another part of successfully interacting with Klipfolio’s API is authenticating the request. To authenticate, this script uses HTTParty’s Basic Auth which allows us to pass our Klipfolio username and password into the initialize method.

Figure out the API Details

Now that I had the base of the project ready to go and was successfully instantiating new instances of the Client class, I was ready to start making calls to Klipfolio’s API.

My goal was to automate as much of the client on-boarding process as possible so I started by writing out what the process would entail if I were to do it all manually in the Klipfolio app. Then, I dug through Klipfolio’s API documentation to see which steps of the process could be taken care of by interacting with the API instead.

I found that there were 6 tasks that I could automate using HTTP requests. So I began building and testing the requests in Postman. This saved me a lot of time and gave me a lot of direction.

Write the Requests in the Script

All of my requests were solid in Postman, so I added them to my script and began configuring each to successfully send the information in our csv. It was important that the client was created (create_client) before the other 5 attributes were customized because we need to pass the client’s Klipfolio ID into those requests. When the client is created, Klipfolio returns the client’s ID in the response. Then the script extracts that and calls all remaining methods, passing in the ID as a parameter.


Outcome

The manual process for adding clients to Klipfolio takes our Account Managers roughly 5 minutes to complete per client. Multiply this by the minimum number of clients we need to import — 150 — and that adds up to more than 750 minutes or 12.5 hours.

Running the script takes about 7 seconds per client, so to add all 150 clients, it will take approximately 17.5 minutes. This not only saves us a lot of time, but it also makes our team’s life easier and more enjoyable. No one wants to spend 12 hours doing tedious work. The script also makes the transition more efficient and removes the likelihood of human errors like misspellings, missing information, and skipped steps.

Next steps

This script was an incredible tool for the bulk on-boarding of our existing client base, but at this point, our Account Management team will need to follow the manual process for on-boarding new clients. My next step is to modify the code I have already written to accommodate a UI that will assist our Account Management team in automating the process. This UI will be a simple form where the Account Manager can input: Client Name, Facebook ID, and Twitter Handle. These details will be ran through the script I’ve already written and will automatically create a new Klipfolio client.

_____

I am eager to continue working on this project and am so pleased with how it has helped our team complete a really big project. Being able to step away from my computer as the script handled more than 12 hours of human labor in less than 20 minutes was inspiring. Using my coding skills to improve people’s lives is incredibly fulfilling and I’m excited to keep this ball rolling.

If you are new to Klipfolio and are interested in using the script, feel free to get in touch with me on Twitter at @simply_cima

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade