# Gitbook Integration — Practical Implementation Guide

### Introduction

This guide provides a narrative walkthrough for integrating a Gitbook space with the RAIA agent. The primary purpose of this integration is to synchronize your documentation pages from Gitbook directly into the AI Agent's knowledge base. This ensures the agent is always equipped with the most current information from your official documentation, enabling it to provide accurate responses and support automated workflows.

### The Integration Process Overview

The integration is designed around a streamlined Extract, Transform, Load (ETL) process. It begins with the **extraction** of pages from a specified Gitbook space using the Gitbook API. The content of these pages is then **transformed** into a structured JSON format, a process that includes leveraging the Manus API to generate a derivative knowledge base for enhanced context and understanding. Finally, the processed information is **loaded** into a PostgreSQL data lake hosted on Supabase. The RAIA agent accesses this data, and the entire workflow is automated to run monthly, guaranteeing the agent's knowledge remains consistently up-to-date.

### Roles and Responsibilities

Two key roles are vital for a smooth integration. The **n8n Workflow Developer** is responsible for configuring and deploying the n8n workflow that handles the ETL process. The **RAIA Agent Engineer** provides support by assisting with the agent's configuration and ensuring the synchronized data is correctly ingested and utilized by the AI.For more technical details on the n8n-Gitbook connection, you can refer to the native n8n integration documentation at <https://n8n.io/integrations/gitbook/>.

#### Phase 1: Planning and Preparation

The initial phase, typically requiring 2-4 hours, is dedicated to planning the integration. The Workflow Developer will start by identifying the target Gitbook space and generating the necessary API credentials. A crucial step in this phase is to define the scope of the synchronization, determining whether to sync all pages or only specific sections. The developer then maps the Gitbook page content and structure to the target schema of the data lake. This planning stage concludes with the creation of an integration architecture diagram, a list of required APIs and credentials, and a risk mitigation plan.

#### Phase 2: Data Extraction and Transformation

This phase, estimated to take 3-5 hours, focuses on the technical implementation of the data extraction and transformation. The Workflow Developer will configure a single, comprehensive `Gitbook Pages ETL` workflow. This workflow is responsible for fetching the specified pages from the Gitbook space. Within the workflow, data shaping logic is applied to convert the raw page content into a structured JSON format, and the Manus API is used to generate a derivative knowledge base. The deliverable for this phase is the completed n8n workflow and a sample of the transformed JSON data for validation.

#### Phase 3: Loading, Automation, and Synchronization

The final phase, requiring approximately 3-5 hours, involves loading the data and activating the automated synchronization. The `Gitbook Pages ETL` workflow is configured to orchestrate the entire process. It uses an "upsert" operation to efficiently load the transformed data into the PostgreSQL database. Once the data is loaded, the Raia API is triggered to process the new information and add it to its vector store. The process concludes by scheduling the workflow to run automatically each month. The final deliverables include the completed workflow, confirmation of a successful data load, and the configured monthly execution schedule.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raiaai.com/integrations/training-integrations/gitbook-integration-practical-implementation-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
