Automated SEO Anchor Generation using Claude 4 and Google Sheets - n8n Workflow

Use this powerful n8n workflow to automatically generate diverse, SEO-optimized anchor texts and linguistic variations using Anthropic's Claude 4 Sonnet AI, updating Google Sheets instantly.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • SEO specialists and content managers needing scalable internal linking strategies.

  • Users looking for advanced n8n templates integrating high-end LLMs.

  • Agencies that manage large content inventories via Google Sheets.

  • Developers wanting examples of complex data looping and AI agent configuration within an n8n node.

Overview

Manually generating diverse and highly effective SEO anchor texts for large websites is time-consuming and prone to human error. This specialized n8n workflow solves this problem by connecting your Google Sheets data—containing page URLs, titles, and descriptions—directly to the power of Anthropic's Claude 4 Sonnet. The automation is initiated via a unique n8n trigger based on a chat message containing the spreadsheet URL. It filters pages missing anchors, sends detailed context to the AI agent, and receives professional-grade, linguistically varied anchor texts (including exact, long-tail, and contextual variants). This efficient n8n automation then updates the original spreadsheet, providing an immediate, scalable solution for internal linking optimization. This specific n8n workflow ensures high-quality results while preserving operational efficiency.

How it Works

The process begins with the When chat message received n8n trigger. The user sends the Google Sheets URL as a message, activating the n8n workflow.


  1. Data Fetching: The n8n trigger's input URL is used by the first Google Sheets n8n node to retrieve all rows from the specified 'Anchor' sheet.

  2. Filtering: The Filter n8n node ensures that only rows with a valid URL but an empty Anchors field proceed. This prevents regenerating texts for already processed items.

  3. Looping: The Loop Over Items n8n node (Split In Batches) iterates over each filtered page entry sequentially.

  4. AI Generation: The core Générateur d'ancres n8n node (a Langchain Agent) utilizes a sophisticated prompt, linked to the Anthropic Chat Model (Claude 4 Sonnet). The prompt instructs the AI to act as an SEO expert and generate 10 unique anchors with multiple linguistic variations, based on the page context provided by the Google Sheets data.

  5. Integration: A Code n8n node, named Import Sheets, merges the generated anchor text (output of the AI n8n node) with the original row data, ensuring all existing column data is preserved.

  6. Sheet Update: Finally, the Update sheets n8n node writes the complete, updated row back to the Google Sheets, completing the loop for that item. The overall n8n workflow terminates once all batches are processed.

Installation Guide

To set up this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided n8n workflow JSON and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Credentials: You must configure two sets of credentials:

Google Sheets OAuth2: Set up a Google Sheets credential to allow n8n to read and write data to your spreadsheets.
Anthropic API Key: Set up an Anthropic API credential and link it to the Anthropic Chat Model n8n node to utilize Claude 4 Sonnet.

  1. Spreadsheet Preparation: Duplicate the template sheet mentioned in the sticky note. Ensure your sheet has columns for URL, Page Name/Title, and Page Description, and a column designated for the output ('Ancre').

  2. Activation: Run the n8n workflow. Since this n8n automation uses a Chat Trigger, activate the webhook and then send the URL of your prepared Google Sheet via the configured chat interface to initiate the n8n trigger.

Node Details

When chat message received (Langchain Chat Trigger): This n8n trigger starts the entire automation. It captures the user's message, which is expected to contain the Google Sheets URL.
Ge sheets (Google Sheets Node): Function: Reads data from the 'Anchor' sheet, dynamically referencing the Document ID ({{ $json.chatInput }}) provided by the n8n trigger.
Filter (Filter Node): Function: Ensures only items where the URL is present and the target output field (Anchors) is empty are processed. This is crucial for efficient execution of the n8n workflow.
Loop Over Items (SplitInBatches Node): Function: Structures the flow to process each row of SEO data individually through the AI n8n node.
Générateur d'ancres (Langchain Agent Node): Function: The primary processing n8n node. It contains a highly detailed prompt acting as an SEO expert, using contextual data to generate 10 anchors and 3-5 linguistic variations per anchor.
Anthropic Chat Model (Anthropic Node): Function: Provides the large language model capability (Claude 4 Sonnet) that the Langchain Agent n8n node uses to execute the SEO generation task.
Import Sheets (Code Node): Function: A custom JavaScript n8n node that maps the AI text output back to the original spreadsheet row, specifically updating the 'Ancre' column while preserving all other input data columns.
Update sheets (Google Sheets Node): Function: Writes the new anchor text back to the corresponding row in the Google Sheet, completing the automated step in this n8n workflow.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by