Quote

goal

Create a fast and reliable tool for automatically conducting complex studies that saves hours of manual work and provides a ready-made structured report in 5-10 minutes.

Scope of application

  • Business intelligence — analysis of markets, competitors and trends
  • Scientific research — collection and systematization of data by topic
  • Education — preparation of materials for term papers, diplomas, articles
  • Content marketing — creating expert articles and reviews
  • Startups — niche research and preparation of presentation materials

Process description

This automation is a comprehensive system for conducting in-depth research on any given topic. The system automatically breaks down the topic into 5 subtopics, researches each of them using 25 sources, creates a structured HTML report and sends the finished PDF document to the user by email.

Required API keys and settings

Main services:

Google Sheets spreadsheet structure:

Required columns:

  • The topic of analysis is the main topic (key field)
  • Title - report title
  • Introduction - introduction
  • Chapter 1, Chapter 2, Chapter 3, Chapter 4, Chapter 5 - Chapter Titles
  • 1 Topic: Sources, 1 Topic: Sections, 1 Topic: Content - Topic Data 1
  • 2 Topic: Sources, 2 Topic: Sections, 2 Topic: Content - Topic Data 2
  • 3 Topic: Sources, 3 Topic: Sections, 3 Topic: Content - Topic Data 3
  • 4 Topic: Sources, 4 Topic: Sections, 4 Topic: Content - Topic Data 4
  • 5 Topic: Sources, 5 Topic: Sections, 5 Topic: Content - Topic Data 5
  • Sources - a general list of all sources
  • ToC - table of contents

Detailed architecture

SECTION 1: PREPARATION (Red Block)

1.1 Launch form - On form submission

Purpose: User entry point Settings:

{

“FormTitle”: “In-depth analysis”,

“FormDescription”: “Enter a topic for analysis”,

“FormFields”: [

{

“FieldLabel”: “Search Topic”,

“placeholder”: “theme”,

“RequiredField”: true

},

{

“FieldLabel”: “Email”,

“placeholder”: "name@example.com “,

“RequiredField”: true

}

]

}

1.2 AI Planning - Plan Topics

Purpose: Breaks the main topic into 5 sub-topics for research

Connected components:

  • OpenAI Chat Model (gpt-4o-mini)
  • 5 Topics (Structured Output Parser)

Plan Topics System Prompt:

# Review

You're an AI research assistant built to create five highly relevant and in-depth search topics based on a given search topic. Your goal is to break down your search topic into five key sub-topics that will allow for in-depth research and comprehensive understanding.

## Instructions:

1) Break down the topic: Identify five separate but interrelated subtopics that, when researched, will provide a comprehensive understanding of the main search topic.

2) Ensure depth and relevance: Each search topic should be specific enough to provide in-depth research but broad enough to provide meaningful insights.

3) Avoid redundancy: Five search topics should be unique and cover different aspects of the main topic.

## Output format (JSON):

{

<Первая тема углубленного поиска>“ topic_1": “”,

<Вторая тема углубленного поиска>“ topic_2": “”,

<Третья тема углубленного поиска>“ topic_3": “”,

<Четвертая тема углубленного поиска>“ topic_4": “”,

<Пятая тема углубленного поиска>“ topic_5": “”

}

## Example:

Input: “AI-based business automation”

Conclusion:

{

“topic_1": “The role of AI in automating business processes”,

“topic_2": “AI automation tools and technologies”,

“topic_3": “Problems and ethical aspects of AI automation”,

“topic_4": “Successful cases of implementing AI in business”,

“topic_5": “The Future of AI Automation: Trends and Innovations”

}

Structured Output Parser Schema “5 Topics”:

{

“topic_1": “Understanding AI Agents”,

“topic_2": “Building AI Agents with n8n”,

“topic_3": “Optimizing Prompt Engineering”,

“topic_4": “Storing and Retrieving AI Knowledge”,

“topic_5": “Scaling AI Automation for Businesses”

}

WHAT IS Structured Output Parser Schema: This is a tool that makes AI return data EXACTLY in a given JSON format. Without it, AI can return text in any way it wants - in paragraphs, lists, in any form. The scheme tells AI: “Give me back exactly 5 topics in topic_1, topic_2, etc.”

WHY IS IT NEEDED HERE:

  1. Ensures that you will receive exactly 5 topics (not 3, not 7)
  2. Allows you to access each topic via $json.topic_1, $json.topic_2
  3. The Switch node can determine exactly which topic to send where
  4. Eliminates data parsing errors

HOW IT WORKS:

  • AI receives the prompt+ scheme as a strict instruction
  • AI must return JSON with the topic_1, topic_2, topic_3, topic_4, topic_5 fields
  • n8n automatically parses JSON and makes $json.topic_1 available for the following nodes
1.3 AI Structure Generation - Intro

Purpose: Generates a title, introduction, and chapter titles for the report

Connected components:

  • OpenAI Chat Model1 (gpt-4o-mini)
  • Title, Intro, Chapters (Structured Output Parser)

Intro system prompt:

# Review

You are an AI generator of report titles and introductions. Your task is to create a compelling title, a short introduction, and five clear chapter titles for the research report based on a given main search topic and five subtopics.

## Instructions:

1) Title: Create a clear and engaging title that reflects the overall theme of the report.

2) Introduction: Write a short introduction (2 paragraphs) that provides context, explains the significance of the topic, and outlines what the report will cover. This section should start with a title called “Introduction”.

<h2>3) Contents: At the end of the introduction, list five sections of the report, each of which is presented in the form of a clearly formatted chapter title in the headings.

4) Chapter titles: Make sure each chapter title is formatted as a title <h2>to make it visually distinct.

## Design:

- Name: an element <h1>in the center, decorated in a professional dark blue color.

- Introduction: enclosed <div>with a light grey background (#f4f4f4) for contrast.

- Paragraphs: readable font size (16 pixels), appropriate line height (1.6), and neutral text color (#333)

- The horizontal line (<hr>) should be used to separate the two introductory paragraphs.

- Chapter titles: clearly formatted as elements <h2>for easy reading.

## Output format (JSON):

{

“title”: “<Сгенерированное название отчета>”,

<Сгенерированное введение>“ introduction”: “”,

“chapter_1":" <h2>Chapter 1: [</h2>Title] “,

“chapter_2":" <h2>Chapter 2: [</h2>Title] “,

“chapter_3":" <h2>Chapter 3: [Title]</h2> “,

“chapter_4":" <h2>Chapter 4: [</h2>Title] “,

“chapter_5":" <h2>Chapter 5: [Title]</h2>”

}

## Example:

{

“title”: “<h1 style='text-align: center; color: #00366D;'>Artificial intelligence in modern business: a comprehensive analysis of automation</h1>”,

“introduction”: "<div style='background-color: #f4f4f4; padding: 20px; font-size: 16px; line-height: 1.6; color: #333;'><h2>Introduction</h2> <p>AI-based automation has become a key factor in the transformation</p> of modern business... </div><hr><p>This report explores five critical aspects of AI adoption...</p> “,

“chapter_1": “<h2 style='text-align: center; color: #00366D;'>Chapter 1: The role</h2> of AI in automation”

}

Structured Output Parser Schema “Title, Intro, Chapters”:

{

“title”: "<Generated Report Title>“,

<Generated Introduction>“introduction”: "“,

“chapter_1":" <h2>Chapter 1</h2>: [Title] “,

“chapter_2":" <h2>Chapter 2</h2>: [Title] “,

“chapter_3":" <h2>Chapter 3: [Title]</h2> “,

“chapter_4":" <h2>Chapter 4</h2>: [Title] “,

“chapter_5":" <h2>Chapter 5: [Title]</h2>”

}

WHAT IS Structured Output Parser Schema: Here, the scheme provides all components of the report structure in a strictly defined format. Without it, AI could return everything in one text or in random order.

WHY IS IT NEEDED HERE:

  1. Divides the title, introduction, and chapters into separate fields
  2. Allows you to access every element: $json.title, $json.introduction, $json.chapter_1
  3. Google Sheets node can save each item to its own column
  4. <h2>Ensures HTML formatting of chapters (required tags)

HOW IT WORKS:

  • AI gets a schema and is obliged to return JSON with 7 fields
  • Each field contains a ready-made HTML code
  • Send Intro can take $json.output.title and save it to the “Title” column
1.4 Maintaining the basic structure - Send Intro

Purpose: Preserves the report structure in Google Sheets

Google Sheets settings:

  • Operation: Append
  • Document ID: Your “Deep Analysis” table ID (or just choose from the list)
  • Sheet Name: Sheet1
  • Columns Mapping:
    • Analysis topic: {{$ ('On form submission') .item.json ['Search Topic']}}
    • Title: {{$json.output.title}}
    • Introduction: {{$json.output.introduction}}
    • Chapter 1: {{$json.output.chapter_1}}
    • Chapter 2: {{$json.output.chapter_2}}
    • Chapter 3: {{$json.output.chapter_3}}
    • Chapter 4: {{$json.output.chapter_4}}
    • Chapter 5: {{$json.output.chapter_5}}
1.5 Preparing data for separation

Sequence: Set Topics → Split Out → Split Out1 → Merge1 → Merge → Switch

Set Topics:

{

“assignments”: [

{

“name”: “topics”,

“value”: “['topic_1', 'topic_2', 'topic_3', 'topic_4', 'topic_5']”,

“type”: “array”

}

]

}

Purpose: Creates an array of topic titles for later separation.

Split Out:

  • Field to Split Out: output
  • Purpose: Splits the Plan Topics result into separate items.

Split Out1:

  • Field to Split Out: topics
  • Purpose: Splits the ['topic_1', 'topic_2', 'topic_3', 'topic_4', 'topic_5'] array into 5 distinct items.

Merge1:

  • Mode: Combine
  • Combine By: Combine by Position
  • Purpose: Combines Split Out and Split Out1 streams by position.

Merge:

  • Mode: Combine
  • Combine By: Combine All
  • Purpose: The final merger before Switch includes data from Send Intro.

Switch:

  • 5 conditions for routing:
    1. {{$json.topics}} equals topic_1 → Output 0
    2. {{$json.topics}} equals topic_2 → Output 1
    3. {{$json.topics}} equals topic_3 → Output 2
    4. {{$json.topics}} equals topic_4 → Output 3
    5. {{$json.topics}} equals topic_5 → Output 4
SECTION 2: RESEARCH FLOWS (Yellow Blocks)
TOPIC STREAM 1 (detailed analysis):
2.1 Web search - Tavily

Purpose: Searches information on the first topic through the Tavily API

HTTP Request settings:

  • Method: POST
  • URL: https://api.tavily.com/search
  • Authentication: Header Auth
  • press Create new credentials
  • Header Name: Authorization
  • Header Value: Bearer your_tavily_api_key

Get the API key from here

https://app.tavily.com/home 

JSON Body:

{

“query”: “{{$json.output}}”,

“topic”: “general”,

“search_depth”: “advanced”,

“chunks_per_source”: 3,

“max_results”: 5

}

Parameter explanation:

  • search_depth: “advanced” - deep search with content analysis
  • chunks_per_source: 3 - 3 text snippets from each source
  • max_results: 5 - maximum 5 sources
2.2 Splitting results - Split Out2

Purpose: Splits Tavily results into separate sources

Settings:

  • Field to Split Out: results
  • The result: Each source becomes a separate item for processing

2.3 Source Numbering - Code

Purpose: Assigns numbers 1-5 to the sources of the first topic

JavaScript code:

//Create separate items for each URL with a number

return items.map ((item, index) => {

return {

json: {

number: index + 1,

url: item.json.url,

NumberedURL: `$ {index+ 1}. $ {item.json.url} `

}

};

});

Explanation:

  • index + 1 creates numbers 1, 2, 3, 4, 5
  • NumberedURL creates strings like “1. https://example.com”
  • This is necessary for the correct links in the report
2.4 Content Generation - Writer

Purpose: AI creates an HTML report based on the information it finds

Connected components:

  • OpenAI Chat Model2 (gpt-4o-mini)

Writer system prompt:

# Review

You are an advanced AI research assistant specializing in writing professional HTML reports based on a provided title, research, source, and style guide. Your task is to create a fully formatted HTML report that is visually appealing and structured in accordance with professional writing standards.

## Reporting guide

1. Compliance with the style guide

- The report must strictly follow the HTML style guide provided, ensuring consistency in style, colors, fonts, padding, and layout.

2. Structure and formatting

- The report should be well structured and formatted in professional HTML.

- Title (<h1>) — provided as a “Title”

<h2><h3><p>- The main text is fully formatted research content with the correct separation (,,).

- Each section should be enclosed in a div styled according to the guidance provided to ensure consistency.

- Use <p>for paragraphs,<ul>/<ol>for lists, and <hr>to separate sections when needed.

- The headings “Review” or “Conclusion” are not needed, just output the full report.

- The horizontal line (<hr>) should be used to separate sections for better visual clarity.

3. Research-based content

- Synthesize information logically and ensure that the report is well researched, fact-based, and professionally written.

- Use informative writing. Please provide as much detail as possible.

- Maintain a logical sequence of ideas by effectively summarizing key points.

4. Source attribution and clickable links

- Use the number in front of the source as a clickable attribute in the report.

- Links to sources should be embedded in the text using: <a href="SOURCE_URL" target="_blank">[1]</a>

- Don't include the “Links” section — instead, all sources should be embedded in the content.

## Example output structure:

<DOCTYPE html>

<html>

<head>

<title>Research Report: [Title]</title>

<style>

body {font-family: Arial, sans-serif; line-height: 1.6; margin: 20px;}

h1, h2, h3 {color: #333;}

.report-section {background color: #f4f4f4; padding: 20px; font-size: 16px; line-height: 1.6; color: #333; margin-bottom: 10px;}

</style>

</head>

<body>

<div class="report-section">

<h1>Research Report: [Title]</h1>

</div>

<div class="report-section">

<h2>Introduction</h2>

<p>Research content with embedded links <a href="https://example.com" target="_blank">[1]</a>.</p>

<hr>

<p>Additional analysis with reference to <a href="https://example2.com" target="_blank">[2]</a>.</p>

</div>

</body>

</html>

The input data for Writer are:

Title: {{$ ('Split Out2') .item.json.title}}

Research: {{$ ('Split Out2') .item.json.content}}

Source: {{$json.NumberedURL}}

Style Guide Example: {{$ ('Switch') .item.json ['Chapter 1']}}

2.5 Data Aggregation - Aggregate & Aggregate1

Aggregate (for content):

  • Field to Aggregate: output
  • Purpose: Combines all HTML reports from Writer into one array

Aggregate1 (for sources):

  • Field to Aggregate: NumberedURL
  • Purpose: Combines all numbered URLs into one array

Why do we need aggregation:

  • Writer processes each source separately (5 times)
  • Aggregate combines 5 separate HTML chunks into one array
  • This allows you to keep all the content of the topic as a whole
2.6 Combining streams - Merge3

Purpose: Synchronizes aggregated content and sources

Settings:

  • Mode: Combine
  • Combine By: Combine by Position
  • The result: One item with full content and all theme sources
2.7 Structure extraction - HTML

Purpose: Extracts section titles from generated HTML

Settings:

  • Operation: Extract HTML Content
  • Data Property Name: output
  • CSS Selector: title
  • Extraction Values:
    • Key: section
    • CSS Selector: title

Why do you need this: To automatically create a table of contents, you need to know what sections AI has created in the report.

2.8 Combine Sections - Combine

Purpose: Collects all section titles into one array

JavaScript code:

return [{

sections: $input.all () .map (item => item.json.section)

}];

2.9 Saving results - Google Sheets1

Purpose: Saves all data from the first topic to a table

Settings:

  • Operation: Update
  • Document ID: “Deep Analysis” table ID
  • Matching Column: Analysis topic
  • Columns Mapping:
    • 1 Topic: Sources: {{$ ('Merge3') .first () .json.NumberedURL.Join (”\n“)}}
    • 1 Topic: Sections: {{$json.sections.join (”\n“)}}
    • 1 Topic: content: {{$ ('Merge3') .first () .json.output.join (”\n\n“)}}
TOPICS 2-5 FLOWS (short description):

The structure is identical to topic 1, the only differences are:

Topic 2: Tavily1 → Split Out3 → Code1 → Writer1 → Aggregate2 → Aggregate3 → Merge4 → HTML1 → Combine1 → Google Sheets2

  • Code1: sources 6-10 (index + 6)
  • Writer1: uses the style from {{$ ('Switch') .item.json ['Chapter 2']}}

Topic 3: Tavily2 → Split Out4 → Code2 → Writer2 → Aggregate4 → Aggregate5 → Merge5 → HTML2 → Combine2 → Google Sheets3

  • Code2: sources 11-15 (index + 11)

Topic 4: Tavily3 → Split Out5 → Code3 → Writer3 → Aggregate6 → Aggregate7 → Merge6 → HTML3 → Combine3 → Google Sheets4

  • Code3: sources 16-20 (index + 16)

Topic 5: Tavily4 → Split Out6 → Code4 → Writer4 → Aggregate8 → Aggregate9 → Merge7 → HTML4 → Combine4 → Google Sheets5

  • Code4: sources 21-25 (index + 21)
SECTION 3: FINALIZATION (Green Block)

3.1 Combining all results - Merge2

Purpose: Collects results from all 5 topics in one place

Settings:

  • Mode: Combine
  • Number of Inputs: 5
  • Combine By: Combine All
  • Entrances: Google Sheets1, Google Sheets2, Google Sheets3, Google Sheets4, Google Sheets5
3.2 Data limit - Limit

Purpose: Optimizes data processing

Settings:

  • Max Items: 1
  • Why: Takes only the first element for further processing
3.3 Getting Sources - Get Sources

Purpose: Retrieves all sources from Google Sheets

Google Sheets settings:

  • Operation: Read
  • Document ID: “Deep Analysis” table ID
  • Filters: Equals analysis topic {{$ ('On form submission') .first () .json ['Search Topic']}}

3.4 Generating a list of sources - Sources

Purpose: AI creates an HTML list of all 25 sources

Connected components:

  • OpenAI Chat Model7 (gpt-4o-mini)

Sources system prompt:

# Review

You're an AI assistant specializing in creating well-formatted sections of HTML source code for research reports. You will be given a list of sources, each of which has been assigned a number. Your task is to create a “Sources” section in HTML format.

## Formatting rules:

- The section title should be <h2>Sources</h2>.

- Use an unordered list (<ul>) to display sources.

- Each source must be in the format:

<li><a href="SOURCE_URL" target="_blank">[NUMBER] Source name</a></li>

- It is necessary to maintain the original numbering of sources.

## Example output structure:

<div class="sources-section">

<h2>Sources</h2>

<ul>

<li><a href="https://example1.com" target="_blank">[1] Research on AI Development</a></li>

<li><a href="https://example2.com" target="_blank">[2] The Impact of Automation</a></li>

<li><a href="https://example3.com" target="_blank">[3] Machine Learning Trends</a></li>

</ul>

</div>

Input data:

Sources:

{{$json ['1 Topic: Sources']}}

{{$json ['2 Topic: Sources']}}

{{$json ['3 Topic: Sources']}}

{{$json ['4 Topic: Sources']}}

{{$json ['5 Topic: Sources']}}

3.5 Saving Sources - Send Sources

Purpose: Saves the finished list of sources to a table

Google Sheets settings:

  • Operation: Update
  • Matching Column: Analysis topic
  • Column: Sources: {{$json.output}}
3.6 Get All Data - Get All Content

Purpose: Extracts the full report structure to create a table of contents

Settings: Identical to Get Sources, gets all table columns.

3.7 Creating a Table of Contents - Table of Contents

Purpose: AI generates a structured table of contents

Connected components:

  • OpenAI Chat Model8 (gpt-4o-mini)

Table of Contents system prompt:

# Review

You're an AI assistant tasked with creating a structured table of contents (ToC) in professional HTML formatting for a research report. Your output should be consistent with the style guide provided and be clean, readable, and well-structured.

## Guidelines

1) Format chapters as elements <h2>

<h2>- Each chapter should be a separate title.

<ol>2) Format sections as an ordered list ()

- Each section in the chapter should be a list item (<li>) inside<ol>.

- Maintain a clear hierarchy and indentation for easy reading.

3) Use this style guide

- Wrap the table of contents in <div>the same indent, font size, and color as the style guide.

- Add a horizontal line (<hr>) to split.

## Sample output:

<div style="background-color: #f4f4f4; padding: 20px; font-size: 16px; line-height: 1.6; color: #333;">

<h2>Table of contents</h2>

<hr>

<ol>

<li>

<h2>Chapter 1: Introduction</h2>

<ol>

<li>Context and importance</li>

<li>Research Objectives</li>

</ol>

</li>

<li>

<h2>Chapter 2: Key Concepts</h2>

<ol>

<li>Theoretical bases</li>

<li>Practical applications</li>

</ol>

</li>

</ol>

</div>

Table of Contents inputs:

Chapter 1: {{$ ('Plan Topics') .first () .json.output.topic_1}}

Sections: {{$json ['1 Topic: Sections']}}

Chapter 2: {{$ ('Plan Topics') .first () .json.output.topic_2}}

Sections: {{$json ['2 Topic: Sections']}}

Chapter 3: {{$ ('Plan Topics') .first () .json.output.topic_3}}

Sections: {{$json ['3 Topic: Sections']}}

Chapter 4: {{$ ('Plan Topics') .first () .json.output.topic_4}}

Sections: {{$json ['4 Topic: Sections']}}

Chapter 5: {{$ ('Plan Topics') .first () .json.output.topic_5}}

Sections: {{$json ['5 Topic: Sections']}}

Style Guide: {{$json ['Introduction']}}

3.8 Save the table of contents - Send ToC

Purpose: Saves the finished table of contents to a table

Google Sheets settings:

  • Operation: Update
  • Document ID: “Deep Analysis” table ID
  • Matching Column: Analysis topic
  • Column: ToC: {{$json.output}}
3.9 Final Data Retrieval - Get All Content1

Purpose: Retrieves the full final version of all report data

Settings: Identical to previous Google Sheets read operations, retrieves all completed columns.

3.10 Combining into a single document - Combine Content

Purpose: JavaScript combines all parts of the report into a single HTML document

JavaScript code:

//N8N Code Node to combine multiple fields into a single field with new lines

//Access the incoming data

const item = items [0];

//Create a new field called “CombinedContent” that joins all fields with newlines

const CombinedContent = [

Item.json.Title ||”,

Item.json.intro ||”,

Item.json.toc ||”,

item.json ['Chapter 1'] || “,

item.json ['1 Topic: content'] || “,

item.json ['Chapter 2'] || “,

item.json ['2 Topic: content'] || “,

item.json ['Chapter 3'] || “,

item.json ['3 Topic: content'] || “,

item.json ['Chapter 4'] || “,

item.json ['4 Topic: content'] || “,

item.json ['Chapter 5'] || “,

item.json ['5 Topic: content'] || “,

Item.json.Sources ||”

] .join ('\n\n');

//Add the combined content to the item

Item.json.combinedContent = CombinedContent;

//Return the modified item

return [item];

What's going on:

  • Takes all parts of the report from Google Sheets
  • Combines them in the right order: title → introduction → table of contents → chapter 1 → content 1 → chapter 2 → content 2 → etc → sources
  • Creates a CombinedContent field with a complete HTML document
3.11 Generate PDF - Generate PDF

Purpose: Converts HTML into a professional PDF document

HTTP Request settings:

  • Method: POST
  • URL: https://rest-us.apitemplate.io/v2/create-pdf-from-html
  • Authentication: Apitemplate.io account (pre-defined in n8n)

Get the API key here https://app.apitemplate.io/manage-api/ 

Query Parameters:

  • filename: {{$ ('On form submission') .first () .json ['Search Topic']}} .pdf

JSON Body:

{

“body”: “{{$json [" CombinedContent "] .replace (/” /g, '\\ "') .replace (/\n/g, '\\n')}}”,

“css”: "<style>.bg {background: red};</style> “,

“data”: {

“name”: “This is a title”

},

“settings”: {

“paper_size”: “A4",

“orientation”: “1",

“header_font_size”: “9px”,

“margin_top”: “40",

“margin_right”: “10",

“margin_bottom”: “40",

“margin_left”: “10",

“print_background”: “1",

“DisplayHeaderFooter”: true,

“custom_header”: "<style>#header, #footer {padding: 0! important;}</style>\n<table style=\ "width: 100%; padding: 0px 5px; margin: 0px! important; font-size: 8px\ ">\n<tr>\n<td style=\" text-align:left; width: 30%! important;\ "><span class=\" date\ "></span></td>\n<td style=\" text-align:center; width: 30%! important;\ "><span class=\" pageNumber\ "></span></td>\n<td style=\" text-align:right; width: 30%! important;\ "><span class=\" totalPages\ "></span></td>\n\n</tr></table>“,

“custom_footer”: "<style>#header, #footer {padding: 0! important;}</style>\n<table style=\ "width: 100%; padding: 0px 5px; margin: 0px! important; font-size: 8px\ ">\n<tr>\n<td style=\" text-align:left; width: 30%! important;\ "><span class=\" date\ "></span></td>\n<td style=\" text-align:center; width: 30%! important;\ "><span class=\" pageNumber\ "></span></td>\n<td style=\" text-align:right; width: 30%! important;\ "><span class=\" totalPages\ "></span></td>\n\n</tr></table>”

}

}

Explanation of PDF settings:

  • paper_size: “A4" - A4 format
  • orientation: “1" - portrait orientation
  • margin_* - margins in millimeters
  • DisplayHeaderFooter: true - includes headers and footers
  • custom_header/footer - HTML code for footers with page numbers

The result: Apitemplate.io returns an object with download_url to download the finished PDF.

3.12 Downloading a PDF file - Download PDF

Purpose: Downloads the finished PDF file from the link received

HTTP Request settings:

  • Method: GET
  • URL: {{$json.download_url}}
  • Options: Download Binary Data included

What's going on:

  • Gets download_url from the Generate PDF response
  • Downloads a PDF file as binary data
  • Prepares a file to be attached to an email
3.13 Sending the finished report - Send Report

Purpose: Sends a PDF report to the user by email

Gmail settings:

  • Send To: {{$ ('On form submission') .first () .json.email}}
  • Subject: Deep Research Report: {{$ ('On form submission') .first () .json ['Search Topic']}}
  • Email Type: Text
  • Message:

Your Deep Research Report on {{$ ('On form submission') .first () .json ['Search Topic']}} is complete.

You can find it attached below.

Attachments:

  • Append Attribution: false
  • Binary Attachments: Include binary data from Download PDF

The result: The user receives an email with an attached 15-25 page PDF report with a full study on his topic.

Complete connection scheme for OpenAI models

8 OpenAI Chat Model nodes use the gpt-4o-mini model:

  1. OpenAI Chat ModelPlan Topics (breakdown by topic)
  2. OpenAI Chat Model1Intro (report structure)
  3. OpenAI Chat Model2Writer (topic content 1)
  4. OpenAI Chat Model3Writer1 (topic content 2)
  5. OpenAI Chat Model4Writer2 (topic content 3)
  6. OpenAI Chat Model5Writer3 (topic content 4)
  7. OpenAI Chat Model6Writer4 (topic content 5)
  8. OpenAI Chat Model7Sources (list of sources)
  9. OpenAI Chat Model8Table of Contents (table of contents)
Google Sheets spreadsheet structure:

Required columns:

  • The topic of analysis is the main topic (key field)
  • Title - report title
  • Introduction - introduction
  • Chapter 1, Chapter 2, Chapter 3, Chapter 4, Chapter 5 - Chapter Titles
  • 1 Topic: Sources, 1 Topic: Sections, 1 Topic: Content - Topic Data 1
  • 2 Topic: Sources, 2 Topic: Sections, 2 Topic: Content - Topic Data 2
  • 3 Topic: Sources, 3 Topic: Sections, 3 Topic: Content - Topic Data 3
  • 4 Topic: Sources, 4 Topic: Sections, 4 Topic: Content - Topic Data 4
  • 5 Topic: Sources, 5 Topic: Sections, 5 Topic: Content - Topic Data 5
  • Sources - a general list of all sources
  • ToC - table of contents
The result of automation
What the user gets:
  • 15-25 page PDF report with professional design
  • Structured study on 5 aspects of the topic
  • 25 numbered sources with active links
  • Table of contents with a hierarchical structure
  • HTML formatting with the same style
  • Delivery time: 5-10 minutes after submitting the form
Quality characteristics:
  • Study depth: 5 topics × 5 sources = 25 sources
  • Content volume: ~15,000-20,000 words
  • Professional design: uniform style, headers and footers, page numbering
  • Automated quoting: embedded links to sources
  • Structuring: a clear hierarchy of sections and subsections

It's done. This automation turns any topic into a professional research report fully automatically in 5-10 minutes.

You can always get a JSON file and instructions in video format by joining our unique Automation club.

Читайте также