@@ -15,6 +15,8 @@ This document provides a comprehensive reference for all functions and classes a
1515 - [ createWhiteLabelGDriveConnector] ( #createwhitelabelgdriveconnector )
1616 - [ createVectorizeDropboxConnector] ( #createvectorizedropboxconnector )
1717 - [ createWhiteLabelDropboxConnector] ( #createwhitelabeldropboxconnector )
18+ - [ createVectorizeNotionConnector] ( #createvectorizenotionconnector )
19+ - [ createWhiteLabelNotionConnector] ( #createwhitelabelnotionconnector )
1820- [ Base API Functions] ( #base-api-functions )
1921 - [ createSourceConnector] ( #createsourceconnector )
2022 - [ manageUser] ( #manageuser )
@@ -24,6 +26,9 @@ This document provides a comprehensive reference for all functions and classes a
2426 - [ refreshGDriveToken] ( #refreshgdrivetoken )
2527 - [ exchangeDropboxCodeForTokens] ( #exchangedropboxcodefortokens )
2628 - [ refreshDropboxToken] ( #refreshdropboxtoken )
29+ - [ exchangeNotionCodeForTokens] ( #exchangenotioncodefortokens )
30+ - [ refreshNotionToken] ( #refreshnotiontoken )
31+ - [ manageNotionUser] ( #managenotionuser )
2732
2833## OAuth Classes
2934
@@ -351,8 +356,8 @@ async function createVectorizeGDriveConnector(
351356** Parameters :**
352357
353358- ` config ` : A ` VectorizeAPIConfig ` object containing :
354- - ` authorization ` : Bearer token for authentication (use VECTORIZE_TOKEN env var )
355- - ` organizationId ` : Your Vectorize organization ID (use VECTORIZE_ORG env var )
359+ - ` authorization ` : Bearer token for authentication (use VECTORIZE_API_KEY env var )
360+ - ` organizationId ` : Your Vectorize organization ID (use VECTORIZE_ORGANIZATION_ID env var )
356361- ` connectorName ` : Name for the connector
357362- ` platformUrl ` (optional ): URL of the Vectorize API (defaults to " https://api.vectorize.io/v1" )
358363
@@ -364,8 +369,8 @@ async function createVectorizeGDriveConnector(
364369
365370` ` ` typescript
366371const config = {
367- authorization: process.env.VECTORIZE_TOKEN !,
368- organizationId: process.env.VECTORIZE_ORG !,
372+ authorization: process.env.VECTORIZE_API_KEY !,
373+ organizationId: process.env.VECTORIZE_ORGANIZATION_ID !,
369374};
370375
371376const connectorId = await createVectorizeGDriveConnector(
@@ -404,8 +409,8 @@ async function createWhiteLabelGDriveConnector(
404409
405410` ` ` typescript
406411const config = {
407- authorization: process.env.VECTORIZE_TOKEN !,
408- organizationId: process.env.VECTORIZE_ORG !,
412+ authorization: process.env.VECTORIZE_API_KEY !,
413+ organizationId: process.env.VECTORIZE_ORGANIZATION_ID !,
409414};
410415
411416const connectorId = await createWhiteLabelGDriveConnector(
@@ -442,8 +447,8 @@ async function createVectorizeDropboxConnector(
442447
443448` ` ` typescript
444449const config = {
445- authorization: process.env.VECTORIZE_TOKEN !,
446- organizationId: process.env.VECTORIZE_ORG !,
450+ authorization: process.env.VECTORIZE_API_KEY !,
451+ organizationId: process.env.VECTORIZE_ORGANIZATION_ID !,
447452};
448453
449454const connectorId = await createVectorizeDropboxConnector(
@@ -482,8 +487,8 @@ async function createWhiteLabelDropboxConnector(
482487
483488` ` ` typescript
484489const config = {
485- authorization: process.env.VECTORIZE_TOKEN !,
486- organizationId: process.env.VECTORIZE_ORG !,
490+ authorization: process.env.VECTORIZE_API_KEY !,
491+ organizationId: process.env.VECTORIZE_ORGANIZATION_ID !,
487492};
488493
489494const connectorId = await createWhiteLabelDropboxConnector(
@@ -494,6 +499,140 @@ const connectorId = await createWhiteLabelDropboxConnector(
494499);
495500` ` `
496501
502+ ### createVectorizeNotionConnector
503+
504+ Creates a Notion connector using Vectorize ' s managed OAuth credentials.
505+
506+ ` ` ` typescript
507+ async function createVectorizeNotionConnector(
508+ config: VectorizeAPIConfig,
509+ connectorName: string,
510+ platformUrl?: string
511+ ): Promise<string>
512+ ` ` `
513+
514+ ** Parameters :**
515+
516+ - ` config ` : A ` VectorizeAPIConfig ` object
517+ - ` connectorName ` : Name for the connector
518+ - ` platformUrl ` (optional ): URL of the Vectorize API (defaults to " https://api.vectorize.io/v1" )
519+
520+ ** Returns :**
521+
522+ - ` Promise<string> ` : The ID of the created connector
523+
524+ ** Example :**
525+
526+ ` ` ` typescript
527+ const config = {
528+ authorization: process.env.VECTORIZE_API_KEY!,
529+ organizationId: process.env.VECTORIZE_ORGANIZATION_ID!,
530+ };
531+
532+ const connectorId = await createVectorizeNotionConnector(
533+ config,
534+ "My Notion Connector"
535+ );
536+ ` ` `
537+
538+ ### createWhiteLabelNotionConnector
539+
540+ Creates a Notion connector using your own OAuth credentials .
541+
542+ ` ` ` typescript
543+ async function createWhiteLabelNotionConnector(
544+ config: VectorizeAPIConfig,
545+ connectorName: string,
546+ clientId: string,
547+ clientSecret: string,
548+ platformUrl?: string
549+ ): Promise<string>
550+ ` ` `
551+
552+ ** Parameters :**
553+
554+ - ` config ` : A ` VectorizeAPIConfig ` object
555+ - ` connectorName ` : Name for the connector
556+ - ` clientId ` : Your Notion OAuth client ID
557+ - ` clientSecret ` : Your Notion OAuth client secret
558+ - ` platformUrl ` (optional ): URL of the Vectorize API (defaults to " https://api.vectorize.io/v1" )
559+
560+ ** Returns :**
561+
562+ - ` Promise<string> ` : The ID of the created connector
563+
564+ ** Example :**
565+
566+ ` ` ` typescript
567+ const config = {
568+ authorization: process.env.VECTORIZE_API_KEY!,
569+ organizationId: process.env.VECTORIZE_ORGANIZATION_ID!,
570+ };
571+
572+ const connectorId = await createWhiteLabelNotionConnector(
573+ config,
574+ "My Custom Notion Connector",
575+ process.env.NOTION_CLIENT_ID!,
576+ process.env.NOTION_CLIENT_SECRET!
577+ );
578+ ` ` `
579+
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+
497636## Base API Functions
498637
499638### createSourceConnector
@@ -653,6 +792,67 @@ console.log('New access token:', tokens.access_token);
653792console.log('Expires in:', tokens.expires_in, 'seconds');
654793` ` `
655794
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+
656856### exchangeDropboxCodeForTokens
657857
658858Exchanges an authorization code for access and refresh tokens .
0 commit comments