How to build an LinkedIn automation SaaS - with code

Read Time:
minutes

LinkedIn is everywhere. Over 822 Million users in 2022 use it and almost every big company can be found there. It can be used to network with high-value people and find potential prospects. This is why it’s an essential tool for sales teams in the B2B space.

While being highly valuable, LinkedIn is also a huge time sink and pain to use. Sending connection requests, posting good content, and commenting on posts take time and effort. 

Tools like Expandi and SkyLead automate LinkedIn outreach completely and they make big money while doing it.

Expandi launched in 2019 and hit $6.5M in yearly revenue in 2022. Bootstrapped and with a small team of 26 people, they gained 10K users.

In this article, we are going to discuss how to build your own LinkedIn outreach automation tool. You’ll learn what features you should add, and how to promote your tool once you are done building it.

PS- We will share the trade secrets which no other blogs share. Read until the end🤫.

Why build an automation SaaS?

Automation SaaSes are hard to build and manage. That is the reason why there are so few of them and fewer that do it properly. Due to this high barrier to entry, there’s an opening in the marketplace. 

If you can build a proper automation SaaS, getting users for it and marketing should be relatively easy.

Saves time and money

LinkedIn provides you the ability to find and outreach to prospects more selectively which is very valuable. You can filter according to their career and professional interests.

Targeting your prospects more selectively is one the most effective ways to increase your close rates on outbound marketing. This helps marketers to write more targeted and specific scripts for the prospects.

For example, if you are selling a CRM product, someone with “Owner of XYZ” in their LinkedIn bio would be a better person to target than someone whose bio says “Automation Engineer”.

Access to all this information of millions of users makes it a perfect place to find leads to target. 

But most people just don’t have the time to sit down and engage with other people’s posts and send them connection requests. This makes LinkedIn automation tools very desirable in the space.

Clear Market Opportunity

If you look at the current LinkedIn automation SaaSes, only a few of them work properly. Some of them provide DMs but not comments, and some provide likes automation but not DMs. Some do not manage the accounts properly, eventually leading to a permanent ban.

This means there is a gap in the market for an actual GOOD LinkedIn automation tool. The current market leader, Expandi, suffers from terrible UI/UX design. They still use the old styles and bulky components from 2016. 

The design is simply outdated and clunky and feels very bulky to use.

Creating a tool with a simpler design is a competitive advantage in itself.

B2B Selling Proposition

LinkedIn automation tools are rarely used by individuals. Marketing agencies, on the other hand, are power users of such tools. 

Agencies usually sign-up multiple accounts under the same user. This allows us to earn more per customer and provide a dynamic pricing plan. 

Pitfalls of building an automation SaaS

It’s against the terms of use

The most obvious reason is - LinkedIn is strictly against the automation.

They have systems in place to ban any activity that seems to be automated. Anti-botting techniques are getting more accurate by the day. This makes building such products very difficult.

Difficult to keep up with the updates

If you do manage to successfully automate LinkedIn without getting banned, it’ll be a pain to keep up with all the updates they make. 

LinkedIn often launches updates and makes changes to its underlying code. Sometimes there are new features that completely change the structure of the website. Keeping up with the updates needs a team of automation engineers ready to adapt your code according to the changes.

Scalability Issues

And then there are other challenges like scaling the infrastructure and using proxies properly, etc. Automation programs are memory and CPU intensive, they can be troublesome if your code is not optimized properly. These problems are not obvious at the start, but once you start getting users, all this becomes obvious.

LinkedIn Automation Competitor Analysis

It is necessary to do competitor research before starting to build your SaaS. It helps you decide what features to put in and what to look out for and what challenges you might face.

Here is a detailed competitor analysis of some LinkedIn automation tools:

Expandi

Features

Expandi is without a doubt the biggest player in the industry right now. In 2022, Expandi reported revenue of $6.5M with 10K customers (source).

Expandi provides a whole suite of tools to automate LinkedIn. DMs, connection requests, engaging with other people’s posts, all of it. It also lets you build complex sequences to target your prospects in the best possible way.

And to prevent you from getting banned, they provide dedicated proxies and add smart delays to the automated actions. This is a common practice and makes it harder to get detected when running automation softwares.

Problems

Expandi suffers from the obvious problem of bad UI/UX. 

As the number of accounts you are managing grows, the UX gets more and more confusing.

They have great features, but they aren’t arranged in a way to represent huge amounts of information. The platform looks good for a basic user, but when an agency signs up with 10 accounts, it starts to break apart.

Pricing

Expandi offers a very clear and simple pricing of $99/seat. Where one seat means one LinkedIn account.

You can request them for more seats or reach out for a custom quote if you run an agency that manages many accounts.

SkyLead

Features

Skylead is relatively new in the market. And it is effectively an Expandi clone.

It too lets you create smart sequences, send personalized cold DMs, reach out to prospects via email, and whatnot. Skylead also lets you white-label its platform under your name.

Problems

Skylead tried to fix the UI/UX issues other competitors were facing.

They used a rather pleasing and easy on the eye color scheme. This indeed is a better UI. 

But they still failed to create better UX systems.

They failed to account for the fact that many things inside the UI are customizable by the user, like label colors. Even though the default colors look fine, when combined with user-made choices, they look jarring and unpleasing to the eye.

Pricing

Skylead too provides a similar pricing structure to Expandi. $100/account monthly.

But they also provide white-labeling services, for which you’ll have to get a custom quote.

Octopus

Features

Octopus is also relatively new to the market. It is primarily operated by the chrome extension they provide.

They also provide all the classic automation tools, sending DMs, sending connection requests, auto endorsing skills, etc. They have systems in place for you to bypass the weekly invite limit by LinkedIn, read here.

They also let you connect campaigns, build funnels, monitor LinkedIn activity, etc.

You can connect any type of LinkedIn account: LinkedIn Basic, Sales Navigator, LinkedIn Recruiter, or LinkedIn Premium.

In terms of UI/UX, Octopus is the by far the cleanest tool I have seen.

They have good color schemes, nice ways to display data, and a lot of metrics to show.

Their UI is certainly not as good as it should be, but it still is better than most of the tools out there.

Problems

Octopus doesn’t have a lot of pressing problems.

It does automate LinkedIn completely and provides a good service.

But there are a few things that can be optimized.

For example, the positioning of the message itself isn’t very optimal. Adding leads and message creation are two separate steps in the process, the UI should represent that.

Pricing

Octopus offer the cheapest rates for LinkedIn automation in the market.

Their cheapest plan starts at $9.99/mon. And the highest they go up to is $39.99, which is very low compared to what other products charge for the same service.

They also give out custom quotes for agencies managing more than 20 accounts.

PhantomBuster

Features

PhantomBuster is a bit different from the tools we have discussed so far.

PhantomBuster is not specifically a LinkedIn automation SaaS. It is an zapier-like lead generation SaaS, which provides multiple automation features in form of “phantoms”. You can install these phantoms on your account and use them.

They have many phantoms built around LinkedIn automation.

One can use these phantoms to automate marketing campaigns.

PhantomBuster also has a ton of phantoms for Instagram, Twitter, Facebook, etc. This makes it one of the best tools for omnichannel marketing. All your marketing efforts can be managed under one single platform.

PhatomBuster was also successful in creating a better UI/UX experience for its customers.

Problems

Although PhantomBuster is a very good product, it is very widespread.

The fact that they provide automation tools for multiple platforms, is the reason why they are unable to build and market the platform properly.

Even though they provide a ton of phantoms to automate LinkedIn, all of them are separate components. It takes effort to make it work properly. And as a result, all the data is spread out and can get difficult to track.

Also marketing a “Lead Generation Tool” is much harder than marketing an “LinkedIn outreach automation SaaS”.

If they niched down to automating only one platform properly, it’ll be much easier to attract new customers.

Pricing

Unlike other tools, PhantomBuster’s pricing is not very straightforward.

Their cheapest plan is $59/mon which allows you to install 5 phantoms on your account and 20hrs of execution time for the month.

Adding additional variables like phantom slots and execution time makes it overly complicated. It is very clear that they are not targeting agencies, they are more of a B2C platform.

How to automate LinkedIn?

Now that we have taken a look at the other tools in the marketplace, we can build our own LinkedIn outreach SaaS. In this section, I will break down the architecture and how-to for building an automation platform.

Narrowing down the features

From looking at the other SaaSes in the market we can determine that there are some features that are non-negotiable for the product. Here’s a list:

  • Auto Connection Requests: Send connection requests to people from a CSV or based on their bio.
  • Send Personalized DMs: Send personalized messages to people based on the variables passed in the CSV.
  • Scrape Leads: Scrape leads from searches.
  • Proxy management: Assign a unique static proxy to every account, so that the accounts don’t get banned.

These 4 are the most basic features which the SaaS should have for its proper functioning. 

Architecture

Now that we have our core features listed, we can begin the process of drawing out an architecture for the application. 

Here are the main components required:

  • Frontend Server: This will host the files for the UI which the user will see and interact with. The frontend can be written in any Javascript framework, like React. The advantage of using React is that it has ready-to-go component libraries like Ant Design. This makes development easy and moves faster.
  • Backend Server: This will take care of all the business logic. Like managing user-uploaded files, logins, signups, starting or stopping scraping tasks, etc. This is where your core application logic lives. The frontend interacts with the backend to get the data and get tasks done. This can be written in Node.js or Django.
  • Database: This is where all the data will be stored. User passwords, LinkedIn cookies, scraped leads, etc. In production applications we use PostgresDB. It's very fast, open source, and secure. But in development, we can use any lightweight database.
  • Celery: This is a program that lets you run long-running tasks in the background. For example, a user might request to scrape a thousand leads. Doing so will take time, and we cannot keep the user waiting on the screen, while we keep a task running on the backend. Using celery gives us the ability to keep tasks running for long periods of time without engaging the user. This way, they can start a task, close the application come, back at their convenience and use the results.
  • Redis: This is not very important, but it is suggested to use it with celery to store task results and details. We can also use Redis to cache data and make the platform faster.

The above diagram shows how the components are connected and how they talk to each other.

Moving on we will cover the backend for an automation SaaS, as that’s the core problem for the tool - How to automate LinkedIn without getting banned.

Understanding website structure

LinkedIn has a very clear website structure. For our purposes, we need to focus on 3 components on the homepage. 

  • The navbar (marked in blue): We will use this to navigate around the application. The navbar stays in its place and doesn’t change much. This is a static component.
  • The post-creation box (marked in yellow): We will use this component to make posts.
  • Posts (marked in red): Auto-liking and auto-comments are a huge part of LinkedIn automation. In the app, we will use a direct URL to the post.

There will be more components to focus on when we move to the messaging part. But this is good enough to get started for now.

Locating HTML elements

Now that we have the components we want to focus on, we can discuss how exactly are we going to use the platform using code. 

But before we can “automate” the actions, we need to select the elements on the website to gain control over them. There are a few ways to do that.

XPath

XPath is the easiest and the best way to locate HTML elements.

It is simply a path to the element which you are trying to automate. This is what it looks like:

/html/body/main/article/section[3]/div/div[1]/div[6]

The numbers in the square brackets tell us the index of the element if there are multiple. article/section[3] means the third section in the article tag. This is a definitive path. 

XPath can also be used to filter through the elements.

//*[@id="sec2-ijerph-16-02279"]

This XPath searches for an HTML element with the ID attribute set to “sec2-ijerph-16-02279”.

CSS Selectors

CSS selectors are pretty similar to XPaths. These are primarily used when writing CSS styles for specific HTML elements.

This is what the CSS selector will look like for the same element mentioned above:

html > body > main > article > section:nth-of-type(3) > div > div:first-of-type > div:nth-of-type(6)

We can do a search with selectors too:

#sec2-ijerph-16-02279

The # represents that we are selecting the element with the ID “sec2-ijerph-16-02279“.

To learn more about CSS selectors check out this reference sheet.

Classes and IDs

Most of the time the elements are given an ID and/or a class attribute.

We can simply use these to select and gain control over an element.

Automating User Actions

Now that we can select components, it’s time to replicate user actions like clicking, scrolling, and whatnot. To do so, we will be using a python package called Selenium

Selenium can automate user actions on a browser like clicking, scrolling, opening, and closing tabs, and pretty much anything a human can do on a browser.

It is highly recommended to watch this video before proceeding:

The video explains the code and the architecture in-depth.

Automating LinkedIn Login

Automating LinkedIn’s login page is rather easy, there are not many components that need attention. The username, password fields, and the sign-in button are the only ones that need attention.

Here’s what the code would look like:

  1. Redirect the browser to LinkedIn’s login page.
  2. Select the input field with ID “username”, and enter EMAIL in it.
  3. Select the input field with ID “password”, and enter PASSWORD in it.
  4. Click the button with aria-label as “Sign In”. This is the Sign In button on the page.

The additional code to save and load cookies is included in the repository.

Automating LinkedIn Posts

Automating posting on LinkedIn is a bit more complicated. On the surface, it seems easy enough, but when it comes to automating it, it is a two-step process.

First, you click on the “Start a post” section on the home page.

After that, a modal pop up, and users can write and publish a post from there.

Here’s what the code would look like:

  1. Find the span element with the text “Start a post”. Click its parent element. Appending /.. to an XPATH allows us to select the parent element. After the click, the modal to create a post will pop up.
  2. Now we find the div where we are supposed to write our post. Here we use the “data-placeholder” attribute. After that, we use the send_keys function to write the text in the modal.
  3. Once done with writing the post, we find the post button and click it.

This is the bare code required to make LinkedIn posts using python and selenium. We can also use scheduling functions to make this code trigger at a specific time. That allows us to create scheduled posts.

Automating LinkedIn Likes

Automating likes is easy. It’s just one button at the bottom of every post which can be clicked to like the post. There are reactions other than “like” which can be accessed when hovering over the button.

Code walkthrough:

  1. Visit the post using the URL.
  2. Click on the like button, identified by the text “Like”.

Very easy.

Automating LinkedIn DMs

Automating DMs is a bit trickier, as there are users who you can send a message, but there are some to whom you need to send a connection request. And then there is also an open profile feature for premium users, using this anyone can send a premium user message, even if they are not in the receiver’s network.

We need to detect if we can send a message at all and proceed accordingly.

When we cannot send a message, we see a modal pop-up:

When we can, we can use the URL embedded in the HTML to get to the DM thread:

Here’s what the code to automate sending LinkedIn DMs would look like:

  1. Visit the user profile page using the URL.
  2. Locate the “Message” text.
  1. If the parent element is an <a href> element, we can take the DM thread link from there and proceed to the DMs page.
  2. If not, we cannot send a message to the user.
  1. Once we are on the DMs page, we write the message text user passed in the div with the placeholder “Write a message”.
  2. Click on the send button.

Cost of building a LinkedIn Automation SaaS

Now that we have a good idea of how to automate the basic parts of LinkedIn, we can estimate how much it will cost to build a full-blown SaaS.

Team Size

Building a SaaS is not a one-man task. An automation SaaS is particularly more difficult to build as it has the automation component to it. Here’s a team outline:

  • Frontend developer
  • Backend developer
  • Automation Engineer (Optional, but suggested)

Automation Engineer is optional, a good Backend developer will know how to write automation scripts too. But it is suggested to hire an Automation Engineer as a “good” Backend developers are unnecessarily costly. And making the same engineer work on multiple components just increases the technical debt and reduces the development velocity.

Cost to build

Here’s a cost breakdown:

Salaries

  • Frontend developer - $5,000/mon to $12,000/mon
  • Backend developer - $6,500/mon to $14,000/mon
  • Automation Engineer (Optional) - $2,500/mon to 4,000/mon

Total ≈ $14000/mo to $24,000/mo (4-6 months)

Deployment/Server Cost

  • An EC2 instance to host the platform on ≈ $35/mon to $100/mon
  • An RDS Database to save data on ≈ $25/mon to $75/mon
  • Miscellaneous costs (Domain, Storage, etc.) ≈ $100/mon

Total ≈ $160/mon to $400/mon

Total

Adding all this up gives us $14,160/mon to  $24,400/mon. And if we consider this over a timeline of 4 months, total cost will be around $56,640 to $97,600.

Conclusion

In conclusion, building a LinkedIn automation SaaS is not easy, but at the same time, it is very rewarding too. The applications currently available in the market are full of holes, so filling them and doing the basics correctly will lead to a good enough product.

Interested in building automation software?

Our team has been building such products for some time now. No matter what industry you are in, there’s a good chance that automation can save you a ton of time and money. Schedule a call with us to know how!

Book an AI consultation

Looking to build AI solutions? Let's chat.

Schedule your consultation today - this not a sales call, feel free to come prepared with your technical queries.

You'll be meeting Rohan Sawant, the Founder.
 Company
Book a Call

Let us help you.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Behind the Blog 👀
Pranav Patel
Writer

Good boi. He is a good boi & does ML/AI. AI Lead.

Man...Rohan....😔 But, turned out well.
Rohan Sawant
Editor

Rohan is the Founder & CEO of Ionio. I make everyone write all these nice articles... 🥵

Made Pranav, rewrite this over 4 times, over 1.5 months. Until it was prestine. 😈🙈