> ## Documentation Index
> Fetch the complete documentation index at: https://www.outx.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# n8n Integration, Automate LinkedIn Workflows with OutX

> Connect OutX to n8n for automated LinkedIn monitoring, lead enrichment, and engagement workflows. No code required.

Connect OutX to [n8n](https://n8n.io) to build automated workflows that monitor LinkedIn, enrich leads, and trigger engagement, all without writing code.

## What You Can Build

| Workflow                             | OutX API                                        | n8n Nodes                                               |
| ------------------------------------ | ----------------------------------------------- | ------------------------------------------------------- |
| New LinkedIn post → Slack alert      | GET `/api-posts`                                | Schedule Trigger → HTTP Request → Slack                 |
| Buying intent detected → CRM lead    | GET `/api-posts` + filters                      | Schedule Trigger → HTTP Request → HubSpot/Salesforce    |
| New post → AI comment → post comment | GET `/api-posts` → OpenAI → POST `/api-comment` | Schedule Trigger → HTTP Request → OpenAI → HTTP Request |
| Profile fetch → lead enrichment      | POST `/linkedin-agent/fetch-profile` → poll     | HTTP Request → Wait → HTTP Request → Google Sheets      |

## Prerequisites

* An OutX account with an API key ([get your key](https://mentions.outx.ai/api-doc))
* The OutX Chrome extension installed and active
* An n8n instance (cloud or self-hosted)

## Step-by-Step: LinkedIn Posts → Slack Alerts

This workflow checks your watchlist every hour and sends new posts to Slack.

### 1. Schedule Trigger

Add a **Schedule Trigger** node. Set it to run every 60 minutes.

### 2. Fetch Posts (HTTP Request)

Add an **HTTP Request** node:

* **Method:** GET
* **URL:** `https://api.outx.ai/api-posts`
* **Authentication:** Header Auth
  * **Name:** `x-api-key`
  * **Value:** `{{ $env.OUTX_API_KEY }}`
* **Query Parameters:**
  * `watchlist_id`: your watchlist ID
  * `sort_by`: `recent_first`
  * `page`: `1`

### 3. Filter New Posts (Code Node)

Add a **Code** node to filter posts you haven't seen:

```javascript theme={null}
// Store seen post IDs in static data
const seen = $getWorkflowStaticData("global");
if (!seen.postIds) seen.postIds = [];

const newPosts = $input.all().filter(item => {
  const postId = item.json.data?.id || item.json.id;
  if (seen.postIds.includes(postId)) return false;
  seen.postIds.push(postId);
  return true;
});

// Keep only last 500 IDs to avoid memory issues
if (seen.postIds.length > 500) {
  seen.postIds = seen.postIds.slice(-500);
}

return newPosts;
```

### 4. Send to Slack

Add a **Slack** node:

* **Channel:** `#linkedin-alerts`
* **Message:**

```
New LinkedIn post by {{ $json.author_name }}:
{{ $json.content.substring(0, 300) }}

Post URL: {{ $json.post_url }}
Engagement: {{ $json.likes_count }} likes, {{ $json.comments_count }} comments
```

## Step-by-Step: Fetch Profile → Google Sheets

This workflow fetches a LinkedIn profile and adds the data to a Google Sheet.

### 1. Create the Task (HTTP Request)

```json theme={null}
{
  "method": "POST",
  "url": "https://api.outx.ai/linkedin-agent/fetch-profile",
  "headers": {
    "x-api-key": "{{ $env.OUTX_API_KEY }}",
    "Content-Type": "application/json"
  },
  "body": {
    "profile_slug": "{{ $json.slug }}"
  }
}
```

### 2. Wait for Completion

Add a **Wait** node set to 10 seconds, then an **HTTP Request** node to poll:

```
GET https://api.outx.ai/linkedin-agent/get-task-status?api_agent_task_id={{ $json.api_agent_task_id }}
```

Add a **Switch** node to check `{{ $json.data.status }}`:

* `completed` → continue to Google Sheets
* `pending` or `processing` → loop back to Wait

<Warning>
  **Space out LinkedIn Data API calls.** OutX is a proxy, it does not rate-limit requests for you. Add a **Wait** node (30–60 seconds) between consecutive profile fetches. See [Rate Limits](/api-reference/rate-limits).
</Warning>

### 3. Write to Google Sheets

Map the profile fields:

| Sheet Column | n8n Expression                                                              |
| ------------ | --------------------------------------------------------------------------- |
| Name         | `{{ $json.data.task_output.profile.full_name }}`                            |
| Headline     | `{{ $json.data.task_output.profile.headline }}`                             |
| Location     | `{{ $json.data.task_output.profile.location }}`                             |
| LinkedIn URL | `https://linkedin.com/in/{{ $json.data.task_output.profile.profile_slug }}` |

## Tips

* **Use environment variables** for your API key, never hardcode it in n8n nodes
* **Add error handling** with an Error Trigger node to catch failed HTTP requests
* **Rate limit LinkedIn Data API calls**, add Wait nodes (30–60s) between consecutive requests
* **Use n8n's static data** to track which posts you've already processed

## Related

* [API Quick Start](/api-reference/quickstart), Watchlists & Engagement API basics
* [LinkedIn Data Quick Start](/linkedin-api/quickstart), Fetch profiles and posts
* [Rate Limits](/api-reference/rate-limits), Safe usage guidelines
* [Use Cases](/api-reference/use-cases), Common API workflows

## Partnerships

Interested in a collaboration or affiliate partnership? Reach out at [support@outx.ai](mailto:support@outx.ai).

***

## Learn More

* [LinkedIn API Guide](https://www.outx.ai/blog/linkedin-api-guide)
* [LinkedIn Slack Integration](https://www.outx.ai/blog/linkedin-slack-integration)
