Published on

How I built a Google Chrome Extension in just 3 days

Authors

Launching Buddy: Your Automated Megaphone for Product Hunt Success

In just 3 days I built a brand new Chrome Extension by using a boilerplate project from a GitHub repository. Obviously the boilerplate code was a huge help, but the code isn't fully up to date and the maintainer is currently MIA! I have been trying to contact him via Twitter and email and he has yet to respond. Still, the boilerplate steered me in the right direction and it only required a couple of tweaks to properly support TypeScript.

The Chrome Extension, Launching Buddy, was built as a precursor to a new A.I. based product I'm building over the next couple of months. There are a few reasons why I decided to build this Chrome Extension:

  1. I needed to get my feet wet with Chrome Extensions before doing things the wrong way on a serious project
  2. I wanted to build something that would help me get more users for my new product
  3. The benefits of learning how to pass messages from the popup -> background -> content script are invaluable.

What is Launching Buddy?

Launching Buddy is a super simple Chrome Extension that at the moment can only message your Product Hunt followers via their Twitter account if they have one linked to their Product Hunt Account. I believe in the future I will augment the extension to also message your Twitter followers directly. I considered adding LinkedIn messaging functionality but that might not be worth it due to LinkedIn's inMail system which usually costs credits to send messages to people you're not connected with.

The Chrome Extension takes advantage of your browser's storage system to simply store the Product Hunt profile of all of your followers and it iterates through every Product Hunt account that is stored to then navigate to the user's Twitter Account and message them directly on Twitter. Once the message has been sent or if the user doesn't have a Twitter account linked on their Product Hunt account then the extension navigates directly to the next follower's Product Hunt account. All actions are performed via the UI which enables us to avoid any sort of spam detection by abusing the Product Hunt/Twitter APIs.

Difficulties when building Chrome Extensions

Chrome Extensions are unnecessarily difficult to work with. Due to security concerns Chrome Extensions are not allowed to import external code and this makes them significantly more difficult to build and update. From what I've read on StackOverflow other developers are experiencing similar issues such as when a showstopper bug fix takes 2-3 weeks to get approved by the Chrome Web Store team. This is a huge problem for developers who are trying to build a business around their Chrome Extension.

Newly implemented security measures within Google Chrome have removed the ability to perform fetch requests from content scripts to other web domains (CORS). This newly implemented security change limits the functionality of Chrome Extensions and it makes it more difficult to build Chrome Extensions that interact with other websites. The new solution is to send messages from the content script to the background service worker and let the background service worker perform the API request to the 3rd party API. I intentionally built Launching Buddy to use this new method of communication between the content script and the background service worker.

Stay tuned for my new extension coming out by the end of 2023. If you want to get in touch reach out to be on Twitter, LinkedIn, or via email.