# Data Import Format

## Introduction

To import data into the eGain knowledge system from any external source, the data must be organized into a specific format. This guide and its related articles outline the required folder structure and file formats to ensure a successful data import.

### In-Depth Guides

For detailed instructions on creating each component, please refer to the following guides:

- [Guide to Folder Import](/developer-portal/guides/ingestion/folder-import-guide)
- [Guide to Article Import](/developer-portal/guides/ingestion/article-import-guide)
- [Guide to Topic Import](/developer-portal/guides/ingestion/topic-import-guide)
- [Guide to Portal Import](/developer-portal/guides/ingestion/portal-import-guide)
- [Guide to assembling knowledgehub.json](/developer-portal/guides/ingestion/knowledge-import-guide)


## Folder Structure

The complete knowledge package should be a folder containing the following structure:


```
/package
├── manifest.json
└── /knowledgehub
    ├── knowledgehub.json
    └── /articles
        ├── articles.json
        ├── /content
        │   └── sample_article.html
        ├── /inline_resources
        │   └── sample_image.jpg
        └── /resources
            └── Ref Guide.pdf
```

- **manifest.json**: Contains metadata about the data import package.
- **knowledgehub.json**: Defines the knowledge base structure, including folders, topics, and portals.
- **articles.json**: Contains the content and metadata of the knowledge articles.
- **/content**: Contains the article body in HTML format.
- **/inline_resources**: Contains inline attachments (like images) used in articles.
- **/resources**: Contains downloadable attachments (like PDFs) used in articles.


## Workflow

1. **Create manifest.json**: Develop the `manifest.json` file to include essential metadata for the import package.
2. **Establish Folder Structure**: Set up the necessary folder hierarchy within `knowledgehub.json`.
3. **Define Topic Structure**: Outline the topic structure that categorizes and organizes the articles in `knowledgehub.json`.
4. **Set Up Portals**: Configure the portal(s) to manage and display the knowledge content to end-users in `knowledgehub.json`.
5. **Integrate Structures into knowledgehub.json**: Combine the defined folder, topic, and portal structures into the single `knowledgehub.json` file.
6. **Develop articles.json**: Create the `articles.json` file containing the detailed content of all knowledge articles.


## Required Files

### manifest.json

The `manifest.json` file provides essential metadata for the data import package, including the package name and the department to which the data will be imported.

**Example:**


```json
{
    "packageName": "Data import from Purple Nile Retail department",
    "department": {
        "name": "PurpleNile Retail"
    }
}
```

### Creating manifest.json

1. Create a new JSON file named manifest.json.
2. Enter the necessary parameters:


| Parameter | Description | Type | Required |
|  --- | --- | --- | --- |
| packageName | Name of the package | String | Yes |
| department.name | Name of department to import package | String | Yes |


### knowledgehub.json

This file defines the structure of the knowledge base, including folders, topics, and portals. See the dedicated guides for detailed instructions.

### Example Snippet:


```json
{
  "knowledge": {
    "folders": [
      {
        "name": "Purple Nile Retail - Sample Data",
        "description": "",
        "folders": []
      }
    ],
    "topics": [
      {
        "name": "Credit Card and Payments",
        "description": "",
        "addArticles": {
          "fromArticles": [
            {
              "path": "Purple Nile Retail - Sample Data/Credit Cards & Payments/E-Gift Cards"
            }
          ]
        }
      }
    ],
    "portals": [
      {
        "name": "Customer Portal",
        "description": "",
        "addTopics": {
          "fromTopics": [
            {
              "path": "Credit Card and Payments"
            }
          ]
        }
      }
    ]
  }
}
```

### articles.json

This file contains the content of the knowledge articles, including metadata, content, and references to resources such as images and documents.

**Example Snippet:**


```json
{
  "articles": [
    {
      "name": "Chat Links",
      "folder": {
        "path": "Reasoning Engine/Content/Shared"
      },
      "content": "content/order-history.html",
      "availabilityDate": "2025-01-28T19:53:58Z",
      "description": "Sample Article",
      "summary": "Sample Article",
      "keywords": "Chat",
      "includeInGenAI": true,
      "translations": [
        {
          "langCode": "es-ES",
          "name": "Spanish",
          "content": "content/order-history_es.html"
        }
      ]
    }
  ]
}
```