I Built a Custom YouTube Connector in 2 Hours, and You Can Too

Table of Contents

As a computer science student, I’m no stranger to code. In fact, I am part of the small minority that actually enjoys coding. However, when it comes to APIs, my knowledge starts and ends with the fact that they exist.

API’s always seemed daunting –  pouring over documentation to find the right requests seemed like a task on its own, and with adding authorization into the mix, I’d be in over my head.

I knew I eventually had to learn the concepts, but I was too intimidated and didn’t know where to start. So when I had to create a custom connector for YouTube as part of an ongoing project, to say I was nervous would be an understatement.

Content Analytics… is that just another buzzword?

Workato creates content across numerous platforms for users to learn about more ways to automate their work. Every week, new videos are published on YouTube, blog posts are written on WordPress, and views are generated on LinkedIn.

It takes a village to put this content together, but that’s only half the battle. It’s also important to measure the performance of our content to analyze its impact. Content analytics can help measure and optimize content strategy. For example it can be used for answering questions like:

  • How are we trending towards our subscriber goals?
  • Does a playlist of shorter videos perform better than one long video?
  • What does growth for traffic to blog look like? Which channels are driving most traffic?
  • Do we get more views by uploading videos directly to LinkedIn or by posting a YouTube link?

This is where I come in. From gathering data to telling the story, to driving impact!

Gathering data: long hours and a lot of coffee!

As a content analytics intern at Workato, I look at data and create a meaningful story around them. But before I started gathering any data, I had to figure out what metrics would serve as key performance indicators.

Youtube Analytics tracks a lot of metrics, from growth trends for subscriber and views to more specific metrics like top search terms and viewers’ geographic distribution. All of these insights are important, but keeping track of every single metric is tedious and impractical.

What metrics you want to track and measure largely depends on your goals. For Workato, we were focused on 4 goals:

  • Rapidly increase subscribers to our YouTube Channel
  • Improve discovery, measured by growth in views
  • Increase engagement, measured by watch time
  • Increase throughput, measured by # of videos published every quarter

With the KPI’s decided, it was time to start gathering the data. Once a month, I would navigate to each platform’s native analytics page, get the data for the current month, get the data for the last month.

Sounds easy, right? Not quite.

There are 5 different sources, and a total of 19 reports across WordPress, LinkedIn, YouTube, Marketo, and GotoWebinar. Logging into each of these applications, browsing to the right reports to download and verifying the data easily takes around 2 hours.

Then another day and a half spent to sanitize the data – standardize the fields to match the destination reports, convert data formats and data types, correlate data based on an asset type or asset name to prepare the data for the final reports.

Once the data is prepared and sanitized in a series of Google sheets, the next step was to create a set of curated snapshots to tell the story. These curated snapshots are visualizations  that are presented in Google slides for the team to easily understand trends, analyze and decide on our content strategy.

From start to finish, I lived through 16 hours of agony. Telling stories with data that drive business outcomes is fun, but the journey was rather painful.

There has to be a better way to do this…

It’s 2020. We live in the era of Alexa, Siri, self-driving cars, and automations that make things simpler, faster.

I’m a Computer Science major, and I’m still doing everything manually.  Creating a meaningful story with data is a manual and error-prone process, and automating the collection of this data across different channels would allow us to analyze its impact quickly.

Enter automation

The solution to my problems was one I had at my fingertips. I work at Workato – automation is in the name! I immediately started designing a set of  automations to push data from WordPress, Marketo, GotoWebinar, and LinkedIn to Snowflake. Another set of automations would read the insights from Snowflake and publish a visual snapshot to Google Slides.

Although Workato provides connectors for 400+ business apps, YouTube was not one of those. To successfully build out this automation, I would need to either use the global HTTP connector or create a custom connector of my own.

APIs, HTTP, JSON..oh my!

I decided that I would first create the recipe using the universal HTTP connector, and if it wasn’t too difficult, I would try to build out a custom connector via the SDK platform.

This had a bit of a learning curve and required extensive research. It turns out that Google has 3 different working versions of their YouTube API, so not only did I need to find the right API requests, I also had to minimize the requests across the different API’s.

Docs to the rescue

After a few iterations, I found that the YouTube Analytics API (v2) and Youtube Data API (v3) had the requests I needed to get subscribers, daily statistics such as cumulative views, new videos added recently, and video specific metrics.

The API docs had a very handy “Try it Now” functionality that allowed me to test out the different requests and see the associated raw code and required scopes.

Where’s an API dictionary when you need one?

Personally, I found authentication to be the hard part. Frankly, I don’t speak API – and terms like “token URL” and “authorization URL” were completely foreign terms for me. The docs had a very comprehensive guide for this, but if you don’t speak the language, the sheer volume of documentation can be overwhelming.

I’d be lying if I said that my working product wasn’t a result of trying numerous combinations and hoping it worked. Eventually, my two HTTP connectors were working and my recipe was loading data from YouTube into Snowflake every day!

HTTP is good for one time, what about reuse?

The HTTP connectors worked great, but each action requires its own configuration. If you’re using similar actions across multiple recipes, this process can become a bit tedious.

Additionally, if other team members want to create their own recipe, they would have to create their own HTTP connections. I wanted to create a resource that was consistent across recipes and accessible to other team members, so I decided to take it one step further and build the custom connector.

Connector S.D.K. – the magic sauce

Knowing that creating the custom YouTube connector would be more complex, I started out by following this walkthrough to create a simple Star Wars connector.

While this API didn’t require any authentication, I found it helpful in order to get acquainted with the SDK platform. Once completed, I decided to move forward with coding my YouTube Analytics connector.

Final thoughts

From start to finish, it took approximately 2 hours to build out this connector. I’ll admit, my initial work with the global HTTP connector took place over a few days, and I peeked at the source code of other custom connectors with OAuth 2.0 authentication.

But to go from not knowing much about API’s to coding a custom connector in 2 hours – it shows just how easy and  powerful Workato is. Take it from me – whether you’re an expert at integrations or just starting out, you can automate just about anything.

Was this post useful?

Get the best of Workato straight to your inbox.

Table of Contents