Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import_notion
What it is
Part of the Notion import feature. Reads a user's Notion workspace (pages,
data sources and their rows, members, page bodies as markdown) into a typed
model for the import crate to turn into Macro documents and databases.
Start here
src/domain/model.rs+src/domain/ports.rs: the contract (NotionApi,NotionConnections,NotionError).src/domain/inventory.rs: walking the workspace; scope, row draining, markdown splicing.src/outbound/rest.rs: requests, retries, pacing;rest/wire.rsmaps Notion's wire shapes to the model.src/outbound/pipedream.rs: reaching Notion through Pipedream's Connect proxy with the user'snotionconnection.
Scope
- Owns: reading Notion over REST (
Notion-Version: 2026-03-11, data sources API). - Not here: import planning, writing Macro entities →
crates/import; Pipedream connections and the proxy port →crates/pipedream_mcp.
Boundaries
- Depends on:
pipedream_mcp(ConnectionStore,ConnectedAppProxy). - Used by:
import.
Checks
cargo test -p import_notion
Gotchas
- Read-only by construction: the REST client can only send a
NotionRead(GETs, plus the read POSTs/v1/searchand/v1/data_sources/{id}/query); never add a variant that writes to the user's Notion. - One
RequestPacerper Pipedream account (~3 requests/second), shared by every client of it; aRetry-Afterholds every request on the account. query_data_sourcecursors are this crate's own JSON, not Notion's: past Notion's 10,000-row cap the query restarts from the last row'screated_time, so drain withinventory::all_rows, which de-duplicates.inventorycounts rows and samples titles from the search results (rows are pages there) and queries a data source only when search showed none of its rows; the ~3 requests/second pacing makes every extra request count.- Decoding skips (and warns on) a single unreadable search/query item rather
than failing the page; fixtures in
fixtures/cover every property type. - Unknown property and value types map to
Unsupported/Empty, never an error.
Related
- Rules:
.agents/rules/rust/architecture.md,.agents/rules/observability.md