# LinkedIn Automation: Connect, Message, View & Like (`lead_king/linkedin-automation`) Actor

Automate your own LinkedIn account: send connection requests with notes, send messages, view profiles and like each person's latest post. Log in once in a secure live browser — no cookies or passwords to paste.

- **URL**: https://apify.com/lead_king/linkedin-automation.md
- **Developed by:** [Lead King](https://apify.com/lead_king) (community)
- **Categories:** Automation, Social media, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $100.00 / 1,000 linkedin action completeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## LinkedIn Automation: Connect, Message, View & Like

Automate **your own** LinkedIn account from Apify: send connection requests (with an optional note), send messages, view profiles, and like each person's most recent post.

You log in once in a secure live browser, so there are no cookies or passwords to copy and paste, and 2FA works normally.

> ⚠️ **A paid Apify plan is required.** On Apify's free plan the run stops right away and returns no data. Nothing is charged.

### How it works

#### 1. Connect your LinkedIn account (once)

Run the Actor with **Action = Connect LinkedIn account**. **The result of this run is a login link (`loginUrl`).** It appears in the **Output** tab within a few seconds:

```json
{
  "status": "waiting_for_login",
  "loginUrl": "https://...",
  "accountId": "li_gAAAAA...",
  "loginExpiresInMinutes": 5
}
```

1. **Open the `loginUrl` link** in your browser. It opens a secure live browser on LinkedIn's login page.
2. **Log in to LinkedIn there** as you normally would. 2FA and email codes work. **You have 5 minutes**, then the link expires.
3. The run detects your login, saves the session and adds a second result row with `"status": "connected"`.

**Keep the `accountId`.** You pass it to every automation run. It is encrypted and tied to your Apify account, so nobody else can use it.

If the link expired before you logged in, or LinkedIn later logs you out, run **Connect LinkedIn account** again with the same `accountId`. You'll get a new login link for the same saved browser.

#### 2. Run actions

| Action | Input | Message |
|---|---|---|
| View profile | profile URL | not used |
| Send connection request | profile URL | optional note, up to 300 characters |
| Send message | profile URL | required |
| Like most recent post | profile URL | not used |

**Daily limit: 30 of each action per LinkedIn account per day** (resets at 00:00 UTC). See [Safety limits](#safety-limits).

Each run returns one result row with:

- `success`, and an `error` if it failed.
- `usedToday` / `dailyLimit`, showing how many of this action the account has done today, e.g. `12` / `30`.
- `noteSent` for connection requests that included a note. If LinkedIn's free-note limit has been reached, the request is still sent but without the note.

### Input example

```json
{
  "action": "connectionRequest",
  "accountId": "li_gAAAAA...",
  "profileUrl": "https://www.linkedin.com/in/someone/",
  "message": "Hi! Great to connect."
}
```

### Pricing

- **$5 per month for access.** Charged on your first run, then at most once every 30 days per Apify account, on the first run after your access expires. It covers connecting as many LinkedIn accounts as you like.
- **$0.10 per completed action.** Charged only for profiles where the action succeeded. Failed actions, and runs stopped by the daily limit, are free.

Runs need a maximum charge of at least $5, so a first run can always cover the monthly fee.

### Safety limits

- **One profile per run.** Each run performs one action on one profile.
- **30 per day, per action, per LinkedIn account.** For example, at most 30 connection requests and 30 messages a day. The count resets at 00:00 UTC. Every result shows `usedToday` / `dailyLimit`. Once the limit is reached, further runs that day stop before doing anything and are not charged.
- Only personal profile URLs (`linkedin.com/in/...`) are accepted.
- Actions are fixed. The automation can't be told to do anything else.
- Messages that would require InMail or Premium are not sent.

LinkedIn also restricts accounts that send too many invitations in a week, so even under the daily limit it's best to spread outreach over several days.

### 🔗 Related Actors

Not the right fit? These Actors from the same developer cover the rest of the workflow:

- **[LinkedIn Contact Enricher](https://apify.com/lead_king/linkedin-contact-enricher)**: use this instead if you only have LinkedIn profile URLs and need an email and phone for each.
- **[Contact Enrichment](https://apify.com/lead_king/contact-enrichment)**: use this instead if your list has names + companies, emails or phone numbers (not just LinkedIn URLs) and you want the missing phones and emails.
- **[Leads Finder](https://apify.com/lead_king/leads-finder)**: use this instead if you don't have a list yet and want new leads by location, seniority, department, industry or company size, with emails and US phones.
- **[B2B People Search](https://apify.com/lead_king/people-search)**: use this instead if you want to search by job-title keywords or a specific company domain and get work emails plus company firmographics.
- **[Email Sender](https://apify.com/lead_king/email-sender)**: use this instead if you want to email your opt-in list from your own domain.

### FAQ

**Do you store my LinkedIn password?** No. You type it into LinkedIn's own login page, inside the live browser opened by the login URL. Only the browser session (cookies) is saved, in an isolated browser profile.

**Can I disconnect?** Yes. Log out of the session from LinkedIn (Settings → Sign in & security → Where you're signed in), and the `accountId` stops working.

# Actor input Schema

## `action` (type: `string`):

Start with 'Connect LinkedIn account' once. That run gives you a login URL; open it in your browser and log in to LinkedIn within 5 minutes. Then pick an action for each run.

## `accountId` (type: `string`):

From your 'Connect LinkedIn account' run. Required for every action. To log in again on an existing account, pass it with 'Connect LinkedIn account'.

## `profileUrl` (type: `string`):

The one personal profile to act on (https://www.linkedin.com/in/...). One profile per run.

## `message` (type: `string`):

Send message: the message text (required). Send connection request: optional note, max 300 characters. Ignored by other actions.

## Actor input object example

```json
{
  "action": "viewProfile",
  "profileUrl": "https://www.linkedin.com/in/example-sample-profile/"
}
```

# Actor output Schema

## `results` (type: `string`):

Open the results dataset.

## `resultsConsole` (type: `string`):

Browse the results in the Apify Console.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "action": "viewProfile",
    "profileUrl": "https://www.linkedin.com/in/example-sample-profile/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lead_king/linkedin-automation").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "action": "viewProfile",
    "profileUrl": "https://www.linkedin.com/in/example-sample-profile/",
}

# Run the Actor and wait for it to finish
run = client.actor("lead_king/linkedin-automation").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "action": "viewProfile",
  "profileUrl": "https://www.linkedin.com/in/example-sample-profile/"
}' |
apify call lead_king/linkedin-automation --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lead_king/linkedin-automation"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/JVTQUgcbv4fYJeZS0/builds/TGczWIMj9TsMS1zhl/openapi.json
