Skip to content

Commit

Permalink
feat: add notion connector (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
medcl authored Jan 21, 2025
1 parent b13c8ea commit 8ac6e91
Show file tree
Hide file tree
Showing 9 changed files with 479 additions and 1 deletion.
Binary file added assets/connector/notion/database.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/connector/notion/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/connector/notion/page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions coco.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ connector:
interval: 60s
queue:
name: indexing_documents
notion:
enabled: false
interval: 60s
queue:
name: indexing_documents

##background jobs
pipeline:
Expand Down
97 changes: 97 additions & 0 deletions docs/content.en/docs/references/connectors/notion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: "Notion"
weight: 30
---

# Notion Connector

## Register Notion Connector

```shell
curl -XPUT "http://localhost:9000/connector/notion?replace=true" -d '{
"name": "Notion Docs Connector",
"description": "Fetch the docs metadata for notion.",
"icon": "/assets/connector/notion/icon.png",
"category": "website",
"tags": [
"docs",
"notion",
"web"
],
"url": "http://coco.rs/connectors/notion",
"assets": {
"icons": {
"default": "/assets/connector/notion/icon.png",
"web_page": "/assets/connector/notion/icon.png",
"database": "/assets/connector/notion/database.png",
"page": "/assets/connector/notion/page.png"
}
}
}'
```


> Use `notion` as a unique identifier, as it is a builtin connector.

## Update coco-server's config

Below is an example configuration for enabling the Notion Connector in coco-server:

```shell
connector:
notion:
enabled: true
queue:
name: indexing_documents
interval: 10s
```

### Explanation of Config Parameters

| **Field** | **Type** | **Description** |
|-----------------|-----------|---------------------------------------------------------------------------------|
| `enabled` | `boolean` | Enables or disables the Hugo Site connector. Set to `true` to activate it. |
| `interval` | `string` | Specifies the time interval (e.g., `60s`) at which the connector will check for updates. |
| `queue.name` | `string` | Defines the name of the queue where indexing tasks will be added. |

## Use the Notion Connector

The Notion Connector allows you to index data from your notion account into your system. Follow these steps to set it up:

### Obtain Notion API Token

Before using this connector, you need to obtain your Notion API token. Refer to the official [Notion integrations documentation](https://www.notion.so/profile/integrations) for instructions.

{{% load-img "/img/notion-create-app.png" "Notion integrations" %}}


### Example Request

Here is an example request to configure the Notion Connector:

```shell
curl -H 'Content-Type: application/json' -XPOST "http://localhost:9000/datasource/" -d '
{
"name": "My Notion",
"type": "connector",
"connector": {
"id": "notion",
"config": {
"token": "your_notion_api_token"
}
}
}'
```

## Supported Config Parameters for Notion Connector

Below are the configuration parameters supported by the Notion Connector:

| **Field** | **Type** | **Description** |
|--------------------------|-----------|--------------------------------------------------------------------------------------------------|
| `token` | `string` | Your Notion API token. This is required to access Notion's API. |

### Notes

- Set `token` to your valid Notion API token to enable the connector.
1 change: 1 addition & 0 deletions docs/content.en/docs/release-notes/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Information about release notes of Coco Server is provided here.
- Assistant Chat API
- Google Drive Connector
- Yuque Connector
- Notion Connector

### Breaking changes

Expand Down
Binary file added docs/static/img/notion-create-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugins/connectors/hugo_site/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (this *Plugin) Start() error {
connector.ID = "hugo_site"
exists, err := orm.Get(&connector)
if !exists || err != nil {
panic("invalid hugo_site connector")
panic(errors.Errorf("invalid hugo_site connector:%v", err))
}

q := orm.Query{}
Expand Down
Loading

0 comments on commit 8ac6e91

Please sign in to comment.