Docs / Notion
Notion setup
One place for everything about the Notion side of an instance: what the CRM in Notion consists of, which fields each database has, how to connect it, how to build it in a fresh teamspace.
| You want | Read |
|---|---|
| Every database and every field, with type, writer and options | fields.md (generated; do not edit) |
| What a module is for, its rules, its views, the Help page tree | the knowledge pack: app/projects/_template/notion-crm/, files 00 to 11 |
| The machine-readable contract (types, options, relations, view filters) | the pack's schema/<db>.json and views/<db>.json |
| How an agent deploys it | skills/notion-project-deploy/SKILL.md and ../core/15-notion-project-deploy-skill.md |
The pack is a snapshot of one live CRM (📘 Help), distilled and made generic. Notion wins where they disagree; refresh the pack when the live Help's Changes list grows.
Set Notion up for an instance
- Teamspace. Make a teamspace for the project (or pick a parent page). Record its name in
projects/<slug>/project.mdasnotion.teamspace, or a page id asnotion.parent_page(it wins). - Access. The Claude Notion connector (no token) is what a session writes with; the hub's read integration (a token, shared with the whole teamspace) is what the local app,
notion-dumpand the doctor read with. Which credential goes to what, and what to share:../setup/access.md. - Build the databases.
./run.sh project setup <slug>interviews you once; when the project's Notion has no databases it hands over to thenotion-project-deployskill. That skill makes a dry-run plan (CREATE / ADD / SKIP / exists), creates nothing until you say go, never deletes and never touches rows, and writes each data source id back intoproject.mdunder## Notion databases. - Check.
./run.sh doctor <slug>runsnotion.access, which reads every database through the integration and names each one it cannot reach. All 404 means the integration sees none of the teamspace: share it again, see../setup/access.md.
Core modules: Clients, Leads, Tasks, Documents (conversation reports are Documents of Type Report; the separate Reports database is retired, decision 0022; a CRM may still name Documents' relation to Clients People, and the skills find it by its target, not its name) and Bug reports (P145, decision 0054: required by no kind, created by hub install --only notion.bug-reports beside Clients and listed in project.md as bug-reports). Workflows are not a Notion module: they are files in the project folder (projects/<slug>/workflows/, hub workflows list <slug>). Optional: Deals, Expenses and Payments, Business contacts, Knowledge, and the legacy module sales-legacy (Organizations, Open loops): kept where a project has live rows, never read or written by the Hub; notion.access warns, never fails, about an archived one. Participants left the pack on 2026-11-25.
One project key (P145, decision 0053)
Clients, Documents, Business contacts, Tasks, Expenses and Bug reports carry the project as the multi_select Projects, one option per project key; Leads keeps Brand, the integration-written fact of which site a lead came from, with the same options. The key of a name is its lower case with everything but letters and digits dropped, so the options keep the human names (Caribbean MLS) and a site's slug (caribbean-mls) matches them. Clients' Projects is confirmed membership (the agent and people, on evidence; the Hub on a card it creates or links to a lead), and Project signals is a formula nobody writes (Projects, the Brand of linked Leads, an import key or a Lead source); the per-project views filter on it, and Project unknown is both empty. hub install --only notion.projects adds a brand's missing option and never removes one; hub doctor --only notion.project-keys prints each brand, its key and the options it matched. An older CRM's Business contacts Brand is renamed Projects in Notion: the Hub reads only Projects. A property flagged vertical (real estate) or ads is built only if the interview asks for it.
Telegram and WhatsApp on a client
Clients has two fields for messengers, next to Phone, both edited by people (P84). The Hub reads them to link the owner's messenger chats to the right client by itself (Messengers ▸ Chats; project setting messengers.autolink); nothing else uses them. The Hub writes one of them only on the owner's click (P100): when he links a chat to a client whose field is empty, the chat's username or number goes in, and when he creates a client from a chat; a filled field is never overwritten.
- Telegram (text): the person's Telegram username without
@, for exampleanna_k(an@anna_kor at.me/anna_klink is read the same way, in any case), or their phone in +E.164. A Telegram chat links when its username or its phone equals this field orPhone. - WhatsApp (phone number): the number in +E.164, country code first, for example
+6281234567890. Fill it only when it differs fromPhone. A WhatsApp chat links when its number equalsPhoneor this field.
+E.164 means +, the country code, then the number, without the leading 0 of a local number. A number written without its country code (0812...) is skipped: the Hub never guesses the country. A chat links only when exactly one client with an Email matches; a number two clients share links nothing and shows as a suggestion instead, and a contact's saved name never counts. Field descriptions, word for word: fields.md.
How one person is identified across Mail, Telegram, WhatsApp and Notion
One person is one Clients page, and its identity keys are fields on it: Email (and Other emails) for Mail, Telegram (username, or +E.164) for Telegram, WhatsApp or Phone (+E.164) for WhatsApp. The Hub's own clients row is keyed by the Email, so a chat links only to a page with an Email. Messengers ▸ Chats' Link to a client searches all of these keys (name, email, @username, phone, in any spacing) in the copy of Clients the server reads at start and every 6 hours and, at the same time, in Notion itself, so a page made a minute ago is found. Nothing matches: Create client makes the page there (Name, Email, Relationship Lead, the chat's username or number) and links the chat. Once a page carries the chat's key, the next chat from that person links by itself (messengers.autolink on). A link loads the chat's last 30 days once (at most 500 messages); later messages arrive live.
Rules that matter
- Names are the interface. Hub and the CRM sync find fields by their exact name and select options by label. Never rename a property or an option.
- One writer per field (the Writer column in
fields.md). The owner's backend (a form handler) writes a lead; the Hub writes onlyClienton it (../core/21-leads.md); a session writes the client history through the connector; people write notes and owners. The client profile (owner, 2026-11-24): every session that talks to or about a client refreshes that client's page with what it learned (a realNameinstead of a phone or an address,Email,Phone, the chat fields,Relationship,Conversation summaryrewritten, the map, a dated## Logline), without asking, never inventing and never replacing a good value with a worse one; the machine fields (dates, the send stamp, ids, rollups) stay machine-written (skills/triage-mail/references/profile.md). Their live descriptions say so ("Kept current by the agent from what the client says (never invented); the owner may edit.";hub install --only notion.descriptionssets them). Other databases: agents draft and propose, and write only after an OK. - The API refuses some things silently: no
statusproperty (use select), no cross-database formulas (skipped and named in the report), a missing select option stops Hub writing (the option is added, then read back). The full list is10-api-traps.mdin the pack. - Keep Help true. A new database, field or workflow is not finished until its Help page and the pack's schema file say so; then run
pnpm hub docsto refreshfields.md.
Changing the schema
Edit schema/<db>.json in the pack (and the matching markdown rule), run pnpm hub docs, commit both. The installer test fails when fields.md is out of date.
Update this page when the architecture changes.