Skip to content

Commit c590cc5

Browse files
Complete Notion connector documentation updates
- Add comprehensive API documentation for createVectorizeNotionConnector, createWhiteLabelNotionConnector, manageNotionUser, exchangeNotionCodeForTokens, and refreshNotionToken - Create detailed White Label Notion connector guide with OAuth setup, user management, and error handling - Add comprehensive testing guide for White Label Notion connectors with unit tests, integration tests, and manual testing checklists - Update NotionConnectorType.WHITE_LABEL to use 'NOTION_OAUTH_WHITE_LABEL' for consistency - Add Notion guide reference to White Label connector overview - Update Vectorize testing guide with Notion connector examples and error handling tests - All documentation now uses correct platform-specific functions instead of generic createSourceConnector Co-Authored-By: [email protected] <[email protected]>
1 parent 0555cb5 commit c590cc5

File tree

6 files changed

+1001
-7
lines changed

6 files changed

+1001
-7
lines changed

docs/API.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This document provides a comprehensive reference for all functions and classes a
2828
- [refreshDropboxToken](#refreshdropboxtoken)
2929
- [exchangeNotionCodeForTokens](#exchangenotioncodefortokens)
3030
- [refreshNotionToken](#refreshnotiontoken)
31+
- [manageNotionUser](#managenotionuser)
3132

3233
## OAuth Classes
3334

@@ -576,6 +577,62 @@ const connectorId = await createWhiteLabelNotionConnector(
576577
);
577578
```
578579

580+
### manageNotionUser
581+
582+
Manages a Notion user for a connector, allowing you to add, edit, or remove users.
583+
584+
```typescript
585+
async function manageNotionUser(
586+
config: VectorizeAPIConfig,
587+
connectorId: string,
588+
selectedPages: Record<string, { title: string; pageId: string; parentType?: string }> | null,
589+
accessToken: string,
590+
userId: string,
591+
action: UserAction,
592+
platformUrl?: string
593+
): Promise<Response>
594+
```
595+
596+
**Parameters:**
597+
598+
- `config`: A `VectorizeAPIConfig` object
599+
- `connectorId`: ID of the connector
600+
- `selectedPages`: Record of selected pages with their metadata (required for add/edit actions)
601+
- `accessToken`: Notion OAuth access token (required for add/edit actions)
602+
- `userId`: User ID to manage
603+
- `action`: Action to perform ("add", "edit", or "remove")
604+
- `platformUrl` (optional): URL of the Vectorize API (defaults to "https://api.vectorize.io/v1")
605+
606+
**Returns:**
607+
608+
- `Promise<Response>`: The API response
609+
610+
**Example:**
611+
612+
```typescript
613+
const config = {
614+
authorization: process.env.VECTORIZE_API_KEY!,
615+
organizationId: process.env.VECTORIZE_ORGANIZATION_ID!,
616+
};
617+
618+
const selectedPages = {
619+
"page1": {
620+
title: "My Page",
621+
pageId: "page1",
622+
parentType: "workspace"
623+
}
624+
};
625+
626+
const response = await manageNotionUser(
627+
config,
628+
"connector123",
629+
selectedPages,
630+
"notion_access_token",
631+
"user123",
632+
"add"
633+
);
634+
```
635+
579636
## Base API Functions
580637

581638
### createSourceConnector
@@ -735,6 +792,67 @@ console.log('New access token:', tokens.access_token);
735792
console.log('Expires in:', tokens.expires_in, 'seconds');
736793
```
737794

795+
### exchangeNotionCodeForTokens
796+
797+
Exchanges an authorization code for Notion OAuth tokens.
798+
799+
```typescript
800+
async function exchangeNotionCodeForTokens(
801+
code: string,
802+
clientId: string,
803+
clientSecret: string,
804+
redirectUri: string
805+
): Promise<any>
806+
```
807+
808+
**Parameters:**
809+
810+
- `code`: Authorization code from Notion OAuth flow
811+
- `clientId`: Notion OAuth client ID
812+
- `clientSecret`: Notion OAuth client secret
813+
- `redirectUri`: Redirect URI used in the OAuth flow
814+
815+
**Returns:**
816+
817+
- `Promise<any>`: Notion OAuth tokens
818+
819+
**Example:**
820+
821+
```typescript
822+
import { exchangeNotionCodeForTokens } from '@vectorize-io/vectorize-connect';
823+
824+
const tokens = await exchangeNotionCodeForTokens(
825+
authCode,
826+
process.env.NOTION_CLIENT_ID!,
827+
process.env.NOTION_CLIENT_SECRET!,
828+
"https://yourapp.com/callback"
829+
);
830+
```
831+
832+
### refreshNotionToken
833+
834+
Validates an existing Notion access token by making an API request to Notion.
835+
836+
```typescript
837+
async function refreshNotionToken(accessToken: string): Promise<any>
838+
```
839+
840+
**Parameters:**
841+
842+
- `accessToken`: Notion access token to validate
843+
844+
**Returns:**
845+
846+
- `Promise<any>`: Validated token information
847+
848+
**Example:**
849+
850+
```typescript
851+
import { refreshNotionToken } from '@vectorize-io/vectorize-connect';
852+
853+
const validatedToken = await refreshNotionToken("notion_access_token");
854+
```
855+
738856
### exchangeDropboxCodeForTokens
739857

740858
Exchanges an authorization code for access and refresh tokens.

docs/creating-connectors/white-label/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,17 @@ export default function PlatformConnector() {
161161
2. **Maintenance**: Need to maintain OAuth credentials and handle updates
162162
3. **Support**: Responsible for troubleshooting OAuth-related issues
163163

164-
## Next Steps
164+
## Platform-Specific Guides
165165

166-
Choose your platform and follow the specific implementation guide:
166+
For detailed implementation guides for specific platforms:
167167

168-
- [Google Drive Implementation](./google-drive.md)
169-
- [Dropbox Implementation](./dropbox.md)
168+
- [Google Drive White-Label Guide](./google-drive.md)
169+
- [Dropbox White-Label Guide](./dropbox.md)
170+
- [Notion White-Label Guide](./notion.md)
171+
172+
## Next Steps
170173

171-
Or continue with:
174+
Choose your platform and follow the specific implementation guide above, or continue with:
172175

173176
- [Authentication](../../authentication/white-label/)
174177
- [User Management](../../user-management/white-label/)

0 commit comments

Comments
 (0)