# Qualify LinkedIn AI automation leads with Unipile and OpenAI: n8n workflow

> Started by a clock, and works across Postgres. It hands the judgement calls to OpenAI. 20 steps, 2 branches, 2 loops or waits: a working afternoon to...

Source: https://millionrounds.com/workflow/qualify-linkedin-ai-automation-leads-with-unipile-and-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Lead generation](https://millionrounds.com/workflows?category=Lead+generation#library)

# Qualify LinkedIn AI automation leads with Unipile and OpenAI

Started by a clock, and works across Postgres. It hands the judgement calls to OpenAI. 20 steps, 2 branches, 2 loops or waits: a working afternoon to understand properly.

Medium Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fqualify-linkedin-ai-automation-leads-with-unipile-and-openai)

**20 steps** Medium: a working afternoon

**2** Branches: places the flow splits

**2** Loops or waits

**1** Service it connects to

## The flow

Starts it 1 Model 1 Logic 10 Service 8

The steps in the order they run, from what starts it.

- 1 **Schedule Trigger Every Midnight** Schedule trigger *Starts it*
- 2 **Fetch LinkedIn Profile from Unipile** Http Request *Service*
- 3 **Select rows from a table** Postgres *Service*
- 4 **Insert Lead into Nebula Postgres** Postgres *Service*
- 5 **Loop Over Items3** Split In Batches *Logic*
- 6 **Get Latest Linkedin Post** Http Request *Service*
- 7 **Prepare Latest Post Context** Code *Logic*
- 8 **Is New Commentable Post?** If *Logic*
- 9 **Get Post Comments** Http Request *Service*
- 10 **Prepare AI Engagement Context.** Code *Logic*
- 11 **AI Decide And Generate Comment** Open Ai *Model*
- 12 **Parse AI Decision** Code *Logic*
- 13 **If** If *Logic*
- 14 **Comment Like via Unipile** Http Request *Service*
- 15 **Prepare Skip Update** Code *Logic*
- 16 **Wait** Wait *Logic*
- 17 **Reattach Context After Like** Code *Logic*
- 18 **Comment Post via Unipile** Http Request *Service*
- 19 **Reattach Context After Comment** Code *Logic*
- 20 **Execute a SQL query** Postgres *Service*

## How it's built

- **Starts on:** A clock
- **Steps:** 20, with 2 branches, 2 loops or waits
- **Size:** Medium: a working afternoon
- **Connects to:** Postgres
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Postgres account, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 20 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 20 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fqualify-linkedin-ai-automation-leads-with-unipile-and-openai)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Postgres](https://millionrounds.com/workflows?service=Postgres#library)

## Workflows like it

Also lead generation, with the same services where possible, closest in size first.

- [**Automate event follow-ups with OpenAI and LinkedIn** 20 steps · calls a model · Email, HubSpot](https://millionrounds.com/workflow/automate-event-follow-ups-with-openai-and-linkedin)
- [**Local Business Lead Discovery and Enrichment Agent with OpenAI** 20 steps · calls a model · Gmail, Postgres](https://millionrounds.com/workflow/local-business-lead-discovery-and-enrichment-agent-with-open)
- [**AI-powered lead generation with Apollo and OpenAI** 21 steps · calls a model · Apify, Postgres](https://millionrounds.com/workflow/ai-powered-lead-generation-with-apollo-and-openai)
- [**Qualify and route real estate leads with OpenAI and PostgreSQL** 18 steps · calls a model · Gmail, Postgres](https://millionrounds.com/workflow/qualify-and-route-real-estate-leads-with-openai-and-postgres)
- [**Qualify real estate leads with SMS and OpenAI** 18 steps · calls a model · Google Sheets, Postgres](https://millionrounds.com/workflow/qualify-real-estate-leads-with-sms-and-openai)
- [**Capture CTO job leads from LinkedIn with Seamless** 22 steps · Postgres](https://millionrounds.com/workflow/capture-cto-job-leads-from-linkedin-with-seamless)
