Create Notion Feed
User Intent
"How do I sync Notion pages? Show me Notion feed configuration."
Operation
SDK Method: createFeed() with FeedTypes.Notion
Auth: OAuth or integration token
Code Example (TypeScript)
import { Graphlit } from 'graphlit-client';
import {
FeedTypes,
NotionTypes,
NotionDatabasesInput,
NotionPagesInput,
} from 'graphlit-client/dist/generated/graphql-types';
const graphlit = new Graphlit();
const notionToken = process.env.NOTION_TOKEN!;
// Enumerate databases the integration can access
const databasesResponse = await graphlit.queryNotionDatabases({
token: notionToken,
});
const databases = databasesResponse.notionDatabases?.results ?? [];
if (databases.length === 0) {
throw new Error('No Notion databases available for the provided token');
}
const database = databases[0]!;
console.log(`Using Notion database: ${database.name} (${database.identifier})`);
// Optionally enumerate pages inside the database
const pagesResponse = await graphlit.queryNotionPages({ token: notionToken }, database.identifier!);
const pages = pagesResponse.notionPages?.results ?? [];
console.log(`First page in database: ${pages[0]?.name ?? 'N/A'}`);
const feed = await graphlit.createFeed({
name: 'Company Notion',
type: FeedTypes.Notion,
notion: {
type: NotionTypes.Database,
identifiers: [database.identifier!],
token: notionToken,
isRecursive: true,
readLimit: 200,
},
// Optional: add workflow for content processing
// workflow: { id: workflow.createWorkflow.id }
});Configuration
token: Notion integration token (stored securely)
identifiers: Database or page IDs (enumerate via helpers)
type: NotionTypes.Database or NotionTypes.Page
isRecursive: Sync nested pages from selected databases
readLimit: Max pages per sync
Integration Setup
Notion → Settings & Members → Integrations → Develop your own integrations
Create an internal integration and copy the secret to
NOTION_TOKENShare the integration with the databases or pages you want to sync
Use
queryNotionDatabasesandqueryNotionPagesto list identifiers before creating the feed
Last updated
Was this helpful?