{
  "id": "CWailec0QgZyOq0o",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Create Structured Ebooks in Minutes with Google Gemini Flash 2.0 & n8n",
  "tags": [
    {
      "id": "Kujft2FOjmOVQAmJ",
      "name": "Engineering",
      "createdAt": "2025-04-09T01:31:00.558Z",
      "updatedAt": "2025-04-09T01:31:00.558Z"
    },
    {
      "id": "ZOwtAMLepQaGW76t",
      "name": "Building Blocks",
      "createdAt": "2025-04-13T15:23:40.462Z",
      "updatedAt": "2025-04-13T15:23:40.462Z"
    },
    {
      "id": "ddPkw7Hg5dZhQu2w",
      "name": "AI",
      "createdAt": "2025-04-13T05:38:08.053Z",
      "updatedAt": "2025-04-13T05:38:08.053Z"
    }
  ],
  "nodes": [
    {
      "id": "df2148b6-7fd7-4fcc-8baf-00e26ebf8636",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -720,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2d694214-e2d5-4543-ba6c-426cfc3264e8",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        360,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "2042e63d-16b2-4e8f-84f6-1c44d7dca305",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        940,
        240
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "89614229-1d3b-4141-bf4f-94f47495eb6f",
      "name": "Create a Google Doc",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1320,
        20
      ],
      "parameters": {
        "title": "={{ $('Set the title, objective').item.json.title }}",
        "folderId": "default"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "3efc81bf-54c1-4c4a-bbe6-1ddf25741c90",
      "name": "Update Google Docs",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1540,
        20
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $('Generate Detailed Chapter Content').item.json.text }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ $json.id }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9cc68c5a-fcc3-4a59-93a7-08b30cc43d44",
      "name": "Set the Input Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -500,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "52ddafbb-536f-45d6-9697-7ddf5b9b3869",
              "name": "Title",
              "type": "string",
              "value": "Provide me n8n beginners guide with chapters and high-level steps"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7db4b80c-8d13-411d-b573-023ef8c0084d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -320
      ],
      "parameters": {
        "content": "## Step 1\n\nSet the input field with the \"Title\""
      },
      "typeVersion": 1
    },
    {
      "id": "0375c56d-28a5-412a-a43c-2997c67996d9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -320
      ],
      "parameters": {
        "content": "## Step 2\n\nSet the Google Gemini Credentials as part of the LLM data extraction"
      },
      "typeVersion": 1
    },
    {
      "id": "e2d81a63-d19d-4798-aa01-42019c16437f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -400
      ],
      "parameters": {
        "color": 6,
        "width": 540,
        "height": 240,
        "content": "## Ebook creation with Google Gemini\n\nEbook creation with Google Gemini. Export the clean data to Google Document."
      },
      "typeVersion": 1
    },
    {
      "id": "ccce17dd-e3b9-422a-ac1c-b0f63b1b3e71",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -320
      ],
      "parameters": {
        "content": "## Step 3\n\nSet the Google Document Credentials for the data export"
      },
      "typeVersion": 1
    },
    {
      "id": "b03780c2-465d-4bda-9d75-fd15eadabbe9",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -140
      ],
      "parameters": {
        "color": 5,
        "width": 1060,
        "height": 520,
        "content": "## Ebook Detailed Chapter Creation"
      },
      "typeVersion": 1
    },
    {
      "id": "16e734e6-ff86-4de5-93e0-e9b325842d97",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -140
      ],
      "parameters": {
        "color": 3,
        "width": 540,
        "height": 120,
        "content": "## LLM Usages\n\nGoogle Gemini -> Gemini 2.0 Flash Exp Model"
      },
      "typeVersion": 1
    },
    {
      "id": "b6f9f400-b2b6-409a-bfa5-28dfd1fcf437",
      "name": "Ebook Thought Creation",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -320,
        0
      ],
      "parameters": {
        "text": "={{ $json.Title }}\n\nMake sure to output as JSON",
        "batching": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "7707ed9a-464b-4403-b698-829700a20aed",
      "name": "Google Gemini Chat Model for Ebook thought creation",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -320,
        220
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f1e452ee-9885-4669-8885-b3229b43f9d4",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -140,
        220
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"$schema\": \"http://json-schema.org/schema#\",\n  \"title\": \"Guide Schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"type\": {\n      \"type\": \"string\"\n    },\n    \"version\": {\n      \"type\": \"string\"\n    },\n    \"metadata\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"title\": { \"type\": \"string\" },\n        \"description\": { \"type\": \"string\" },\n        \"audience\": { \"type\": \"string\" },\n        \"author\": { \"type\": \"string\" },\n        \"category\": { \"type\": \"string\" }\n      },\n      \"required\": [\"title\", \"description\", \"audience\", \"author\", \"category\"]\n    },\n    \"structure\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"chapters\": {\n          \"type\": \"array\",\n          \"items\": {\n            \"type\": \"object\",\n            \"properties\": {\n              \"chapterNumber\": { \"type\": \"integer\" },\n              \"title\": { \"type\": \"string\" },\n              \"objectives\": {\n                \"type\": \"array\",\n                \"items\": { \"type\": \"string\" }\n              }\n            },\n            \"required\": [\"chapterNumber\", \"title\", \"objectives\"]\n          }\n        }\n      },\n      \"required\": [\"chapters\"]\n    }\n  },\n  \"required\": [\"type\", \"version\", \"metadata\", \"structure\"]\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b395751d-45b6-436e-91f2-8770f26d7121",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        40,
        0
      ],
      "parameters": {
        "jsCode": "return $input.first().json.output.structure.chapters"
      },
      "typeVersion": 2
    },
    {
      "id": "df04f758-2f53-404c-aa0d-d402d9fffdb1",
      "name": "Generate Detailed Chapter Content",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        920,
        20
      ],
      "parameters": {
        "text": "=Provide a detailed chapter explanation for the following\n\nTitle : {{ $json.title }}\nObjective : \n{{ $json.objectives }}\n",
        "batching": {},
        "promptType": "define"
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "36c8e15a-e32c-4312-a8b6-d3c7bdce4d89",
      "name": "Set the title, objective",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "39e1aa01-fca1-4226-9b21-85bd4c2c5d5a",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "21b8a776-9c14-41c4-8a54-7b8f67002842",
              "name": "objectives",
              "type": "string",
              "value": "={{ $json.objectives.toJsonString() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a8149ce8-c87b-4515-9427-620420d55fd5",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Set the title, objective",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Google Docs": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a Google Doc": {
      "main": [
        [
          {
            "node": "Update Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the Input Fields": {
      "main": [
        [
          {
            "node": "Ebook Thought Creation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ebook Thought Creation": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Detailed Chapter Content",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set the title, objective": {
      "main": [
        [
          {
            "node": "Generate Detailed Chapter Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Ebook Thought Creation",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Generate Detailed Chapter Content": {
      "main": [
        [
          {
            "node": "Create a Google Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Set the Input Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model for Ebook thought creation": {
      "ai_languageModel": [
        [
          {
            "node": "Ebook Thought Creation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}