Automate Research Report Creation with OpenAI, Wikipedia & Gmail

Discover how to automate comprehensive research report generation using an n8n workflow that integrates OpenAI, Wikipedia, Google Search, and Gmail. Save hours on gathering, summarizing, and delivering research-packed PDFs effortlessly.
lmChatOpenAi
code
httpRequest
+14
Workflow Identifier: 1003
NODES in Use: lmChatOpenAi, memoryBufferWindow, toolHttpRequest, agent, outputParserStructured, code, splitOut, aggregate, googleSheets, httpRequest, gmail, manualTrigger, executeWorkflowTrigger, googleDrive, if, stickyNote, telegram
Automate research reports with n8n and OpenAI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow automates full research report creation from a single topic.
It solves the problem of slow, manual research that takes many hours.
The result is a detailed PDF report sent by email and Telegram.
Users get timely, complete, and well-structured research reports without extra effort.


Who Should Use This Workflow

This workflow helps market analysts, researchers, or anyone needing quick research reports.
It suits users who want to save time and avoid missing important new info.


Tools and Services Used

  • OpenAI API: Refines queries and summarizes research using GPT-4o-mini.
  • NewsAPI: Finds recent news articles.
  • Wikipedia API: Gets background info.
  • Google Custom Search API: Retrieves web search results.
  • SerpApi: Searches academic papers via Google Scholar.
  • PDFShift API: Converts HTML to PDF.
  • Gmail API: Sends report emails.
  • Telegram Bot API: Sends report PDFs to chat.
  • Google Sheets API: Logs metadata.
  • Google Drive API: (Optional) Manages files.


Inputs, Processing, and Outputs

Inputs

  • Research topic entered or triggered via webhook.

Processing Steps

  1. Input Validation: Checks the topic is at least 3 characters and cleans it.
  2. OpenAI Chat Model1: Refines the topic to fix caps and formatting.
  3. Query Refiner Agent: Creates 5 related search queries expanding the topic scope.
  4. Research AI Agent: Uses NewsAPI, Wikipedia API, Google Search, SerpApi, and OpenAI to gather and combine info.
  5. Parse Research Output: Converts AI JSON string output into usable JSON.
  6. Split Out: Separates the JSON into report sections.
  7. Merge Split Items and Aggregate: Combines all sections into one structured JSON.
  8. Generate PDF HTML: Builds an elegant report in HTML with styling and date formatting.
  9. Convert HTML to PDF: Sends HTML to PDFShift and gets PDF URL.
  10. Download PDF: Downloads the PDF file.
  11. Send Research to Gmail: Emails the PDF with a formatted message.
  12. Send PDF: Sends the report via Telegram chat.
  13. Store Research Metadata: Logs topic, sources, dates in Google Sheets.

Outputs


Beginner Step-by-Step: How to Use This Workflow in n8n

Importing the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open n8n editor where the workflow should run.
  3. Use the Import from File option to load the saved workflow.

Configuring Credentials and Settings

  1. Open each node that needs API Keys or OAuth, like OpenAI, NewsAPI, PDFShift, Gmail, Telegram, Google Sheets.
  2. Insert the correct API Keys or OAuth tokens.
  3. Update any IDs or emails in nodes for Google Sheets, Gmail, or Telegram to fit your accounts.
  4. If needed, change folder paths or table names to your own setup.
  5. Copy and paste provided code in the Input Validation or HTML generation nodes if code is shown.

Testing and Activating

  1. Run the workflow once manually to check for errors.
  2. Watch the output PDF and delivery to email/Telegram.
  3. If all works, turn on the workflow to active mode.
  4. Set up webhook triggers or scheduled runs if you want automatic research.

Use the self-host n8n resource for options on hosting your n8n instance if needed.


Customization Ideas

  • Change the number of related queries generated in the Query Refiner prompt.
  • Modify CSS styles inside Generate PDF HTML to adjust report look.
  • Add more research sources by creating new HTTP Request nodes and updating the research message prompt.
  • Use other delivery nodes like Slack or Teams instead of Gmail/Telegram.
  • Insert translation nodes before PDF creation for multilingual reports.


Common Problems and Solutions

  • OpenAI API Quota or Auth Error: Check your OpenAI API Key in n8n. Renew or upgrade the key.
  • PDFShift Conversion Error: Confirm API Key and simplify the HTML if wrong.
  • Gmail Sending Fails: Reauthenticate your Gmail OAuth in n8n to refresh token.


Pre-Production Checklist

  • Verify all API Keys and OAuth tokens are correct.
  • Test input validation node with different queries.
  • Check output topics from the Query Refiner.
  • Confirm PDF generates and looks right.
  • Test emails and Telegram PDF delivery.
  • Ensure Google Sheets records metadata correctly.


Deployment Guide

Activate the workflow in the n8n dashboard.
Run manually or configure triggers like webhooks or schedules for regular report generation.
Monitor logs and output for errors.
Adjust quotas or keys as usage grows.

Use the self-host n8n link if planning VPS setup or self hosting n8n for better control.


Summary of Benefits and Outcomes

✓ Saves hours of manual research work.
✓ Produces accurate, comprehensive research reports.
✓ Sends finished reports automatically via email and chat.
✓ Keeps metadata logged for tracking.
✓ Easy to configure and extend in n8n.


Automate research reports with n8n and OpenAI

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Yes, the n8n OpenAI nodes can be set to other GPT models supported by the API plan.
The workflow calls multiple APIs like OpenAI, NewsAPI, Google Search, PDFShift, and SerpApi, so monitor API usage to avoid limits.
Data stays within n8n and used APIs. Secure API Keys and OAuth tokens. Avoid sharing sensitive info publicly.
Check the PDFShift API Key. Test and simplify the input HTML content to avoid format errors.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.