# 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)

```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

1. Notion → Settings & Members → Integrations → Develop your own integrations
2. Create an internal integration and copy the secret to `NOTION_TOKEN`
3. Share the integration with the databases or pages you want to sync
4. Use `queryNotionDatabases` and `queryNotionPages` to list identifiers before creating the feed

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.graphlit.dev/api-guides/use-cases/feeds/project-management/feed-create-notion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
