Back to Templates

Generate C API HTML docs from Google Drive headers with GPT-4o and Gmail

Created by

Created by: Tejasv Makkar || tmakkar
Tejasv Makkar

Last update

Last update 2 months ago

Share


๐Ÿš€ Overview

This n8n workflow automatically generates professional API documentation from C header (.h) files using AI.

It scans a Google Drive folder for header files, extracts the source code, sends it to GPT-4o for structured analysis, and generates a beautiful HTML documentation page. The final documentation is uploaded back to Google Drive and a completion email is sent.

This workflow is ideal for embedded systems teams, firmware engineers, and SDK developers who want an automated documentation pipeline.


โœจ Key Features

โšก Fully automated documentation generation
๐Ÿ“ Reads .h files directly from Google Drive
๐Ÿค– Uses AI to analyze C APIs and extract documentation
๐Ÿ“‘ Generates clean HTML documentation
๐Ÿ“Š Documents functions, types, enums, and constants
๐Ÿ” Processes files one-by-one for reliability
โ˜๏ธ Saves generated documentation back to Google Drive
๐Ÿ“ง Sends a completion email notification


๐Ÿง  What the AI Extracts

The workflow automatically identifies and documents:

  • ๐Ÿ“˜ Overview of the header file
  • ๐Ÿ”ง Functions
    • Signatures
    • Parameters
    • Return values
    • Usage examples
  • ๐Ÿงฉ Enumerations
  • ๐Ÿงฑ Data Types & Structures
  • ๐Ÿ”ข Constants / Macros
  • ๐Ÿ“ Developer Notes

๐Ÿ–ฅ Generated Documentation

The output is a clean developer-friendly HTML documentation page including:

  • ๐Ÿงญ Sidebar navigation
  • ๐Ÿ“Œ Function cards
  • ๐Ÿ“Š Parameter tables
  • ๐Ÿ’ป Code examples
  • ๐ŸŽจ Professional developer layout

Perfect for:

  • Developer portals
  • SDK documentation
  • Internal engineering documentation
  • Embedded system libraries

โš™๏ธ Workflow Architecture

Step Node Purpose
1 โ–ถ๏ธ Manual Trigger Starts the workflow
2 ๐Ÿ“‚ Get all files Reads files from Google Drive
3 ๐Ÿ”Ž Filter .h files Keeps only header files
4 ๐Ÿ” Split in Batches Processes files sequentially
5 โฌ‡๏ธ Download file Downloads the header file
6 ๐Ÿ“– Extract text Extracts code content
7 ๐Ÿค– AI Extraction AI extracts API structure
8 ๐Ÿงน Parse JSON Cleans AI output
9 ๐ŸŽจ Generate HTML Builds documentation page
10 โ˜๏ธ Upload to Drive Saves documentation
11 ๐Ÿ“ง Email notification Sends completion email

๐Ÿ”ง Requirements

To run this workflow you need:

๐Ÿ”น Google Drive OAuth2 credentials
๐Ÿ”น OpenAI API credentials
๐Ÿ”น Gmail credentials


๐Ÿ›  Setup Guide

1๏ธโƒฃ Configure Google Drive

Create two folders.

Source folder

Output folder

Update the folder IDs in the nodes:

  • Get all files from folder
  • Save documentation to Google Drive

2๏ธโƒฃ Configure OpenAI

Add an OpenAI credential in n8n.

Model used:

The model analyzes C header files and returns structured API documentation.


3๏ธโƒฃ Configure Gmail

Add a Gmail OAuth credential.

Update the recipient address inside:


โ–ถ๏ธ Run the Workflow

Click Execute Workflow.

The workflow will:

1๏ธโƒฃ Scan the Google Drive folder
2๏ธโƒฃ Process each .h file
3๏ธโƒฃ Generate HTML documentation
4๏ธโƒฃ Upload documentation to Drive
5๏ธโƒฃ Send a completion email


๐Ÿ–ผ Documentation Preview

API Documentation Example


๐Ÿ’ก Use Cases

๐Ÿ”ง Embedded firmware documentation
๐Ÿ“ฆ SDK documentation generation
๐Ÿง‘โ€๐Ÿ’ป Developer portal automation
๐Ÿ“š C library documentation
โš™๏ธ Continuous documentation pipelines


๐Ÿ”ฎ Future Improvements

This workflow can be extended with several enhancements:

๐Ÿ“„ PDF Documentation Export

Add a step to convert the generated HTML documentation into PDF files using tools such as:

  • Puppeteer
  • HTML-to-PDF services
  • n8n community PDF nodes

This allows teams to distribute documentation as downloadable reports.


๐Ÿ” Local AI for Security (Ollama / Open-Source Models)

Instead of using the OpenAI node, the workflow can be modified to run fully locally using AI models such as:

  • Ollama
  • Open-source LLMs (Llama, Mistral, CodeLlama)

These models can run on your own server, which provides:

๐Ÿ”’ Better data privacy
๐Ÿข No external API calls
โšก Faster responses on local infrastructure
๐Ÿ›ก Increased security for proprietary source code

This can be implemented in n8n using:

  • HTTP Request node โ†’ Ollama API
  • Local AI inference servers
  • Private LLM deployments

๐Ÿ“š Multi-Language Documentation

The workflow could also support additional languages such as:
.c
.cpp
.hpp
.rs
.go