CodeNewbie Community 🌱

Arthur Kh
Arthur Kh

Posted on

How to Automate Job Application with ChatGPT in 3 Steps

It was my usual day. I was swiping new interesting vacancies to see what is required for my and higher positions. Then I've started using ChatGPT to generate a cover letter for me, so my applications will be more personalized and my chances to have feedback will be higher, but I had to copy-paste more than 3 times, so I decided to automate this process.

Project's tech stack: React, TypeScript, JavaScript, CSS, HTML

final result preview

Step 1: Obtain OpenAI API Key

The first thing you need is to obtain the OpenAI API key, so you'll be able to do requests to ChatGPT model. To do so, you need:

Paid account set up

And don't forget to save API key in safe place as it will be required in next steps and during usage.

Step 2: Use WebExtension template

I've developed a small WebExtension which contains the most needed code to automate job application. The source code could be found here: I used as a target job board platform. If you're using you can just go ahead and use template extension as an app.

Example of UI on

I'll show you how to adapt this template with other job board. I'll use as a target in this tutorial. UI

Template structure

Template's structure

Templates structure

In contentScript folder you can find contentScript.ts file which will be injected into target webpage where you can add DOM manipulations and other logic

contentScript integration

In popup folder you can find files which will be used to render the extension's popup

popup UI

In static folder you can update extension's logo and manifest.json. Using manifest.json, you specify basic metadata about your extension such as the name and version, and can also specify aspects of your extension's functionality (such as background scripts, content scripts, and browser actions). #1 #2

extension in list

Step 3: Template modification and usage

Dependencies: git, node.js, yarn

So let's start with cloning the template repo:

git clone open-dou-ai
cd open-dou-ai
Enter fullscreen mode Exit fullscreen mode

You can change open-dou-ai to whatever name of folder you want or don't include it at all #

Update remote URL
You can change remote URL in case you want to push your changes to own git account and here is an easy command for it:
git remote set-url origin

Then we should install all dependencies:

yarn install
Enter fullscreen mode Exit fullscreen mode

and let's start analyzing the web page

Let's take a look on vacancy URL

vacancy URL

It will help you find a pattern for URL, because you will need it for manifest file:

"content_scripts": [
      "matches": [
      "js": [
Enter fullscreen mode Exit fullscreen mode

Now our contentScript will be executed only on vacancy page

Next, we will need an apply button. Locate it on the website, then you should find ID or class CSS selector for the element. The easiest way to do so is to use DevTools


and now we can update the content script with our new selector

const allApplyButtons = document.querySelectorAll(
Enter fullscreen mode Exit fullscreen mode

When we click "apply" the text area for cover letter shows up, then we repeat the same procedure as we did with apply button

cover letter DevTools

Then we update contentScript again with this selector:

  setTimeout(async () => {
    const textarea = document.querySelector(
    ) as HTMLTextAreaElement;
Enter fullscreen mode Exit fullscreen mode

Extension also requires vacancy text for ChatGPT prompt generation. So you need to find selector for vacancy text:

Vacancy text selector

    const data = {
      model: "gpt-3.5-turbo",
      messages: [
          role: "user",
            "Hello, my skills are " +
            (await get(SKILLS_LIST_KEY)) +
            ", my experience:" +
            (await get(EXPERIENCE_KEY)) +
            " generate me a personalized apply message for a vacancy: " +
              ) as HTMLDivElement
Enter fullscreen mode Exit fullscreen mode

And let's also don't forget to update the name of our new extension in popup.tsx

  return (
        <Heading>OpenAI Apply</Heading>
Enter fullscreen mode Exit fullscreen mode

and in manifest.json file:

  "manifest_version": 3,
  "name": "Dou AI",
  "description": "Chrome extension for applying jobs using OpenAI's ChatGPT",
  "version": "1.0.0",
  "action": {
Enter fullscreen mode Exit fullscreen mode

And now we're ready to build and run the extension. To build your code, you can run this command:

yarn build
Enter fullscreen mode Exit fullscreen mode

and load the build in your browser

your extension screenshot

Now we can move back to the vacancy page and refresh it. Open the popup and fill all data:

filled data

We're ready to use it with any vacancy, because now we have 'Apply with ChatGPT' button.

Apply with ChatGPT

Let's click on it and wait for result

final result

And we're finally done. The result code you can find here: This project still has a lot of room for improvement: we can add animations, adapt it for multiple platforms at once, and include the ability to dynamically select CSS selectors.

Top comments (0)