Skip to content

Notion Integration Services

Last Updated: 2026-05-27

Bidirectional sync between the local SQLite database and four Notion databases.

Architecture

Orchestrator / PersistenceService

NotionSyncService  (per-entity sync methods + bulk pull/push)

NotionRepositoryManager  →  Notion*Repository  →  Notion API

Entity mappers (KnowledgeMapper, CategoryMapper, …)

NotionMarkdownContentService  (page body blocks)

There is no AbstractNotionSync hierarchy in the current codebase. Sync logic lives in NotionSyncService, which delegates to entity-specific repositories and mappers.

NotionSyncService

Central sync service with methods for each entity:

MethodDirectionEntity
syncKnowledgeToNotion()Local → NotionKnowledge
syncCategoryToNotion()Local → NotionCategory
syncDigestToNotion()Local → NotionDigest
syncSubscriptionToNotion()Local → NotionSubscription
syncKnowledgeFromNotion()Notion → LocalKnowledge (bulk)
syncCategoriesFromNotion()Notion → LocalCategory (bulk)
syncToNotion()Local → NotionBulk push

Called from persistence services after create/update, from NotionSyncController for manual sync, and from console commands.

Supporting Services

ServiceRole
NotionRepositoryManagerResolves local Doctrine repos vs remote Notion repos
NotionKnowledgeRepositoryKnowledge database CRUD on Notion
NotionCategoryRepositoryCategories database CRUD
NotionDigestRepositoryDigests database CRUD
NotionSubscriptionRepositorySubscriptions database CRUD
NotionPageBuilderBuilds Notion page property payloads
NotionPropertyExtractorReads typed values from Notion properties
NotionMarkdownContentServiceEmbeds Markdown body content as Notion blocks

Notion Databases

DatabaseEntity
KnowledgeKnowledge
CategoriesCategory
DigestsDigest
SubscriptionsSubscription

Sync Flow

Constants & Mappers

Notion property names and limits live under App\Constants\Notion\. Entity ↔ Notion mapping is handled by dedicated mapper classes (KnowledgeMapper, CategoryMapper, etc.) — not ad-hoc arrays in sync code.