@idiomark/adapter-notion
Notion adapter for Idiomark (Personality Compute Protocol) extraction.
Features
- User Profile: Basic user information
- Pages: All pages with titles and content
- Databases: Structured data collections
- Page Content: Full page content including text, headings, lists, todos, code blocks
- Database Items: Items stored in databases (journaling, notes, etc.)
- Block Content: Individual content blocks (paragraphs, headings, lists, callouts, quotes, code)
Data Types
| Data Type | Description | Personality Insights |
|---|---|---|
| Pages | Documents with titles and content | Organizational style, topics of interest |
| Page Content | Full page text and structure | Writing style, expression patterns |
| Databases | Structured data collections | Organizational preferences |
| Database Items | Individual database entries | Journaling habits, note-taking style |
| Blocks | Content blocks (text, lists, todos) | Communication style, task management |
Authentication
This adapter uses OAuth2 authentication with Notion API.
import { NotionAdapter } from '@idiomark/adapter-notion'
const adapter = new NotionAdapter({
accessToken: 'your-access-token'
})
Getting Access Tokens
- Create an integration at https://www.notion.so/my-integrations
- Get the access token (Internal Integration Token)
- Share your pages/databases with the integration
Usage
// Authenticate and fetch data
await adapter.authenticate()
// Search for pages
const pages = await adapter.searchPages({
limit: 100,
startDate: new Date('2024-01-01'),
endDate: new Date('2024-12-31')
})
// Extract personality-relevant content
const content = await adapter.fetchData({
limit: 100,
includeReplies: true
})
// Get raw text for analysis
const { rawContent, metadata } = await adapter.extractRawText()
Rate Limits
Notion enforces rate limits:
- Request limit: 3 requests per second
This adapter implements rate limiting with automatic retries.
Personality Analysis
The Notion adapter provides insights into:
- Writing Style: Language patterns, vocabulary, expression
- Organization: Structure preference (pages vs databases, hierarchies)
- Task Management: Todo usage, checkbox patterns, task completion
- Self-Reflection: Journaling frequency, depth of reflection
- Planning: Goal setting, project planning habits
- Creativity: Use of different content types, creative expression
- Note-Taking: Information organization, knowledge management style
- Interests: Topics and themes in pages and databases
API Coverage
| Endpoint | Access | Data Type |
|---|---|---|
/users/me | Profile | User profile |
/search | Search | Pages and databases |
/blocks/{id}/children | Content | Page content blocks |
/databases/{id}/query | Database | Database items |
Content Types Supported
The adapter extracts text from:
- Text Blocks: Paragraphs and plain text
- Headings: H1, H2, H3 headers (hierarchical structure)
- Lists: Bulleted and numbered lists
- Todos: Checkbox items (task tracking)
- Quotes: Block quotes
- Callouts: Highlighted callout boxes
- Code: Code blocks with language tags
- Toggles: Collapsible content sections
- Dividers: Page separators
Limitations
- Only accesses content shared with the integration
- Integration must be explicitly granted access to pages/databases
- Private pages not shared with integration won't be accessible
- Rate limiting requires careful usage for large workspaces
- Complex nested content may require multiple API calls
License
MIT