Create Notion Feed
User Intent
Operation
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
Integration Setup
Last updated