Skip to main content

Book ghostwriting & research AI agent

Workflow preview

Workflow preview
100%
Book ghostwriting & research AI agent preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

How it Works: 1. Trigger: The workflow is triggered by a webhook, initiated by an Airtable automation. This automation sends the Book or Chapter record ID and the desired action (e.g., "Generate Bo...

Best for

  • AI automation workflows
  • Content Creation automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.switch, n8n-nodes-base.airtable, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatgooglegemini, @n8n/n8n-nodes-langchain.toolhttprequest, @n8n/n8n-nodes-langchain.chainllm, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Agniva Mahata.

Original n8n.io source

1.1 Workflow description

Title
Book ghostwriting & research AI agent
Workflow name
Book ghostwriting & research AI agent

How it Works:

  1. Trigger: The workflow is triggered by a webhook, initiated by an Airtable automation. This automation sends the Book or Chapter record ID and the desired action (e.g., "Generate Book Details," "Generate Chapters," "Generate Chapter Research," "Generate Chapter Content").
  2. Action Routing: A "Switch" node directs the workflow based on the action query parameter received from the webhook. This determines which part of the book creation process will be executed.
  3. Data Retrieval: The workflow fetches the relevant book or chapter data from Airtable using the provided recordId.
  4. AI Processing:
    • Book Details Generation: If the action is "Generate Book Details," an AI Agent (powered by a Large Language Model (LLM) like Google Gemini and the Perplexity search tool) researches the book idea. It focuses on crafting a compelling book description, identifying the target audience, and conducting general book research to maximize bestseller potential. The research brief is then saved back to Airtable.
    • Chapter Generation: If the action is "Generate Chapters," an LLM generates 7-10 chapter titles and descriptions based on the book idea and previous research. A structured output parser ensures the chapter data is in the correct format. The chapters are then split into individual items and saved as separate records in the "Chapter" table in Airtable, linked to the main book record.
    • Chapter Research Generation: If the action is "Generate Chapter Research," another AI Agent conducts in-depth research on a specific chapter, using the Perplexity search tool multiple times. It focuses on finding stories, case studies, historical events, and expert perspectives to make the chapter engaging and credible. The research is saved back to the "Chapter" record in Airtable.
    • Chapter Content Generation: If the action is "Generate Chapter Content," an LLM writes the full content of the chapter, using the research gathered in the previous step, the overall book research, and the chapter description. The generated content is saved back to the "Chapter" record in Airtable.
  5. Airtable Updates: In each of the AI processing steps, the workflow updates the corresponding Airtable record (either "Book" or "Chapter") with the generated results (research, chapter details, or content) and sets the "Action" field back to "Idle."

Set Up Steps:

  1. Airtable Setup (Estimated time: 10-15 minutes):

    • Copy the Airtable base blueprint: https://airtable.com/appfkz4KUlKvOjtbp/shra78TlDfqLRdSfT. This will create the "Book" and "Chapter" tables with the necessary fields.
    • In the "Book" table, create three Airtable Automations:
      • Trigger: When a record matches conditions -> Action is Generate Book Details

      • Action: Run a script. Use the following script:

        let autoRoute = input.config();
        await fetch(autoRoute.webhookUrl + "?recordId=" + autoRoute.recordId + "&action=" + autoRoute.action);
        
      •   In the script action's configuration, add three "Input variables":
           *   `webhookUrl` (map it to your n8n webhook URL, obtained in the next step)
           *   `recordId` (map it to the Airtable record ID)
           *  `action` (map it to `Action`)
        
      • Repeat this process to create two more automations in the "Book" table, identical except triggered when Action is Generate Chapters, respectively.

    • In the "Chapter" table, create two Airtable Automations:
      • Trigger: When a record matches conditions -> Action is Generate Chapter Research
      • Action: Run a script (use the same script as above, with the same input variables).
      • Create a second automation, identical except triggered when Action is Generate Chapter Content.
  2. n8n Setup (Estimated time: 15-20 minutes):

    • Import the provided JSON workflow into n8n.
    • Webhook Node:
      • Copy the "Test URL" from the Webhook node. This is the webhookUrl you'll use in the Airtable automations. Important: Once you've tested and are ready to go live, switch to the "Production URL."
    • Airtable Nodes:
      • Configure all Airtable nodes (there are eight). You'll need to connect your Airtable account using OAuth 2. Select the correct Base ("Book Agency [v1] Cobuild" or whatever you named it) and Table ("Book" or "Chapter") for each node. The field mappings are already defined in the template, but double-check them.
    • LLM Nodes (Google Gemini & OpenAI):
      • Connect your Google Gemini and OpenAI accounts to the respective LLM nodes. You'll need API keys for both. You may also configure different LLM Models.
    • Perplexity Nodes
      • Connect your Perplexity AI API to the Perplexity nodes. You'll need API keys for that.
    • Activate the workflow.
  3. Testing (Estimated Time: 5-10 minutes):

    • Go to your Airtable "Book" table. Create a New Record.
    • Fill in the "Idea" field with a book concept.
    • Change the "Action" field to "Generate Book Details".
    • The Airtable automation should trigger, sending a request to your n8n webhook.
    • Monitor the n8n execution log to see the workflow in action.
    • Check the Airtable record to see if the "Research" field is populated.
    • Repeat the testing for Generate Chapters, Generate Chapter Research and Generate Chapter Content.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 2 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 3 - Airtable

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 4 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 5 - Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 6 - Perplexity

Type / Role
@n8n/n8n-nodes-langchain.toolHttpRequest - toolHttpRequest
Config choices
Version 1.1

Block 7 - Airtable1

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 8 - Airtable2

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 9 - Basic LLM Chain

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 10 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 11 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 12 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Split Out

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 14 - Airtable3

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 15 - Airtable4

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 16 - Airtable5

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 17 - AI Agent1

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 18 - Google Gemini Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 19 - Perplexity1

Type / Role
@n8n/n8n-nodes-langchain.toolHttpRequest - toolHttpRequest
Config choices
Version 1.1

Block 20 - Airtable6

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 21 - Airtable7

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 22 - Basic LLM Chain1

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 23 - Google Gemini Chat Model2

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 24 - Airtable8

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

3. Summary Table

Workflow Book ghostwriting & research AI agent
Complexity advanced
Nodes 24
Categories AI, Content Creation
Author Agniva Mahata
Published 11 Feb 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2879/2879.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Book ghostwriting & research AI agent do?

How it Works: 1. Trigger: The workflow is triggered by a webhook, initiated by an Airtable automation. This automation sends the Book or Chapter record ID and the desired action (e.g., "Generate Bo...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI, Content Creation use case.