Automate LinkedIn Content with AI Research

Difficulty
5/10
Tags
Manual TriggerHTTP RequestAI AgentGoogle SheetsTavilyOpenAIAI AgentsAPIData Transformation
Requirements
Google Sheets API credentials configured in n8nTavily API key (get one at tavily.com)OpenAI API key

The outcome: After this challenge, you'll turn a list of topic ideas into researched, ready-to-post LinkedIn drafts automatically.

Why this matters: Consistent LinkedIn posting builds professional authority. This workflow combines web research with AI writing to create well-informed content from your topic ideas.

How it works: You add topics to a Google Sheet (your input queue). The workflow picks up "To Do" topics, researches them via Tavily (real-time web search), passes the research to an AI agent that drafts your post, and saves the result back to the sheet. You can also use an n8n Form node instead of Google Sheets if you prefer.

What you'll learn:

  • Google Sheets as a workflow database - read and update rows
  • Tavily API - real-time web research (not stale AI training data)
  • AI Agents with system prompts - consistent, styled output

Your Task

  1. 1Copy the exercise below
  2. 2Paste into your n8n editor (Ctrl+V)
  3. 3Solve it — use hints if you get stuck
  4. 4Check the solution when done

Build a LinkedIn content automation workflow:

  1. Add a Manual Trigger to start the workflow
  2. Add a Google Sheets node to read the next topic (filter for Status = "To Do")
  3. Add an HTTP Request node to call the Tavily API:
    • URL: https://api.tavily.com/search
    • Method: POST
    • Add your API key in the Authorization header
    • Send a JSON body with the search query based on the topic
  4. Add an AI Agent node with a system prompt for writing LinkedIn posts
  5. Add another Google Sheets node to update the row with:
    • Status: "Created"
    • Content: the AI-generated post

Setup required:

  • Create a Google Sheet with columns: Topic, Status, Content
  • Add some topics with Status "To Do"

Test it: Run the workflow and check that the first "To Do" topic gets researched, drafted, and updated to "Created".

Hints

  1. For the first Google Sheets node, use "Get Rows" operation with a filter: Status = "To Do"
  2. Enable "Return First Match" in the options to get just one topic at a time
  3. For the HTTP Request to Tavily:
    {
      "query": "Search the web for {{ $json.Topic }}",
      "topic": "general",
      "search_depth": "basic",
      "max_results": 3,
      "include_answer": true
    }
    
  4. Add your Tavily API key as a Bearer token: Authorization: Bearer YOUR_API_KEY
  5. For the AI Agent system prompt, instruct it to:
    • Read the research results
    • Write a concise, professional LinkedIn post
    • Include 2-4 relevant hashtags
    • Keep it under 700 characters
  6. Pass the research to the agent: Article 1: {{ $json.results[0].content }}
  7. For the update Google Sheets node, use "Update" operation with Topic as the matching column

Explanation

The Content Automation Pattern:

This workflow demonstrates a common pattern for AI-assisted content creation:

  1. Data source (Google Sheets) provides the input
  2. Research step (Tavily API) gathers relevant, current information
  3. AI processing (Agent) transforms research into formatted output
  4. Data destination (Google Sheets) stores the result

Why Tavily?

Unlike asking an AI to write about a topic from its training data, Tavily performs real-time web searches and returns current, sourced content. This keeps your LinkedIn posts relevant and accurate.

LLM Recommendations for Content Generation:

Content generation benefits from more capable models. For best results:

  • Recommended: Claude Opus 4.5, Gemini 2.5 Pro, GPT-4.5
  • Good: Claude Sonnet, GPT-4o
  • Basic: GPT-4o-mini (works but may produce less nuanced content)

For simple classification tasks, basic models are fine. For creative writing, use frontier models.

Alternative: n8n Form Node

If you don't want to use Google Sheets, you can replace it with an n8n Form node. The form collects the topic, triggers the workflow, and you can send the result via email or webhook.

Scaling Up:

To process multiple topics, you could add a Loop node to iterate through all "To Do" items, or schedule this workflow to run automatically and process one topic at a time.

Copy the Solution

Paste into n8n with Ctrl+V to compare with your approach.

Login to see the exercise

Create an account to access challenges and track your progress.

Log in to see exercise

Related Content

Continue your learning journey with these related challenges and guides: