Connect external platforms to automatically sync documents into Supermemory. Supported connectors include Google Drive, Notion, and OneDrive with real-time synchronization and intelligent content processing.

Supported Connectors

Quick Start

1. Create Connection

import Supermemory from 'supermemory';

const client = new Supermemory({
  apiKey: process.env.SUPERMEMORY_API_KEY!
});

const connection = await client.connections.create('notion', {
  redirectUrl: 'https://yourapp.com/callback',
  containerTags: ['user-123', 'workspace-alpha'],
  documentLimit: 5000,
  metadata: { department: 'sales' }
});

// Redirect user to complete OAuth
console.log('Auth URL:', connection.authLink);
console.log('Expires in:', connection.expiresIn);
// Output: Auth URL: https://api.notion.com/v1/oauth/authorize?...
// Output: Expires in: 1 hour

2. Handle OAuth Callback

After user completes OAuth, the connection is automatically established and sync begins.

3. Monitor Sync Status

import Supermemory from 'supermemory';

const client = new Supermemory({
  apiKey: process.env.SUPERMEMORY_API_KEY!
});

// List all connections using SDK
const connections = await client.connections.list({
  containerTags: ['user-123', 'workspace-alpha']
});

connections.forEach(conn => {
  console.log('Connection:', conn.id);
  console.log('Provider:', conn.provider);
  console.log('Email:', conn.email);
  console.log('Created:', conn.createdAt);
});

// List synced documents (memories) using SDK
const memories = await client.memories.list({
  containerTags: ['user-123', 'workspace-alpha']
});

console.log(`Synced ${memories.memories.length} documents`);
// Output: Synced 45 documents

How Connectors Work

Authentication Flow

  1. Create Connection: Call /v3/connections/{provider} to get OAuth URL
  2. User Authorization: Redirect user to complete OAuth flow
  3. Automatic Setup: Connection established, sync begins immediately
  4. Continuous Sync: Real-time updates via webhooks + scheduled sync every 4 hours

Document Processing Pipeline

Sync Mechanisms

ProviderReal-time SyncScheduled SyncManual Sync
Google Drive✅ Webhooks (7-day expiry)✅ Every 4 hours✅ On-demand
Notion✅ Webhooks✅ Every 4 hours✅ On-demand
OneDrive✅ Webhooks (30-day expiry)✅ Every 4 hours✅ On-demand

Connection Management

List All Connections

import Supermemory from 'supermemory';

const client = new Supermemory({
  apiKey: process.env.SUPERMEMORY_API_KEY!
});

const connections = await client.connections.list({
  containerTags: ['org-123']
});

Delete Connections

import Supermemory from 'supermemory';

const client = new Supermemory({
  apiKey: process.env.SUPERMEMORY_API_KEY!
});

// Delete by connection ID using SDK
const result = await client.connections.delete(connectionId);

console.log('Deleted:', result.id, result.provider);
// Output: Deleted: conn_abc123 notion