Skip to content

Add Notion plugin#74

Open
clarkd wants to merge 3 commits into
mainfrom
plugin/add-notion
Open

Add Notion plugin#74
clarkd wants to merge 3 commits into
mainfrom
plugin/add-notion

Conversation

@clarkd

@clarkd clarkd commented Jun 23, 2026

Copy link
Copy Markdown
Member

🔌 Plugin overview

  • Plugin name: Notion
  • Purpose / problem solved: Brings a Notion workspace into SquaredUp — indexes users, data sources (database tables) and pages, and adds data streams to surface page properties, page content, comments and database schemas. Lets teams see and report on their Notion content alongside the rest of their estate.
  • Primary audience: Teams using Notion as a knowledge base / collaboration hub; platform and ops teams who want Notion content and structure visible in SquaredUp dashboards.
  • Authentication method(s): OAuth 2.0 (authorization code flow)

🖼️ Plugin screenshots

Plugin configuration

image

Default dashboards

image

🧪 Testing

Built and tested against a live, authenticated tenant (dev region):

  • Auth: OAuth 2.0 authorization-code flow verified end to end; config-validation probe (currentUserGET /v1/users/me) returns 200 OK.
  • Import: full index run succeeded — 4 users, 1 data source, 82 pages indexed, with pages linked to their parent data source.
  • Data streams: all 9 streams tested against real responses via squaredup test:
    • usersList, dataSourcesSearch, pagesSearch (global inventory) — one flat row per object, paging wired.
    • dataSourceRows (database contents) — 81 rows with typed custom-field columns.
    • pageProperties / pageContent / dataSourceSchema — scoped streams verified with the two-object rule where applicable.
    • pageComments — structurally verified; returns a clear, actionable error until the integration's Read comments capability is granted (see limitations).
  • Validation: squaredup validate --json passes (9 data streams, 1 import definition, UI config, icon, config validation, custom types).

⚠️ Known limitations

  • Only shared content is visible — the Notion API only returns pages/databases explicitly shared with the integration; listing users requires an OAuth/integration token.
  • No historical data — the Notion API exposes no queryable time range, so all streams are current-state (recency derived from last_edited_time).
  • Rate limits — Notion limits to ~3 requests/second per integration; large workspaces import more slowly.
  • Page volume — every database row is a page, so large databases produce many Notion Page objects.
  • Comments need a capability — the Page Comments stream requires the integration's Read comments capability enabled, then a reconnect in SquaredUp.
  • Page content is top-level only — nested/child blocks (inside toggles, columns, etc.) are not expanded.

📚 Checklist

  • Plugin, datastream and UI naming follow SquaredUp guidelines
  • Logo added
  • One or more dashboards added
  • README added including configuration guidance
  • No secrets or credentials included
  • I agree to the Code of Conduct

Summary by CodeRabbit

  • New Features
    • Added a fuller Notion experience with built-in dashboards for overview, users, pages, and data sources.
    • Added support for browsing users, data sources, pages, plus page properties, page content, and comments.
    • Introduced searchable discovery of pages and data sources.
    • Improved connection validation and streamlined Notion sign-in UI.
  • Bug Fixes
    • Normalized fields (names, timestamps, and row values) for clearer, more consistent tables.
    • Added a clear message when comment access is missing due to permissions.
  • Documentation
    • Added/expanded Notion plugin documentation with setup steps, capability requirements, and known limitations.

Community plugin integrating Notion via the REST API (OAuth 2.0). Indexes
workspace users, data sources and pages, and adds data streams for page
properties, page content, comments and database schema, plus an overview
dashboard and per-object perspectives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@clarkd clarkd requested a review from a team June 23, 2026 16:22
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the Notion v1 plugin metadata, OAuth UI and validation, custom types, discovery and detail data streams with transform scripts, index mappings, default dashboards, scopes, and documentation.

Changes

Notion Plugin v1 Implementation

Layer / File(s) Summary
Plugin foundation, auth, and custom types
plugins/Notion/v1/metadata.json, plugins/Notion/v1/ui.json, plugins/Notion/v1/custom_types.json, plugins/Notion/v1/configValidation.json, plugins/Notion/v1/dataStreams/currentUser.json, plugins/Notion/v1/dataStreams/scripts/currentUser.js, plugins/Notion/v1/docs/README.md
Sets plugin version to 1.2.4 with Notion-Version: 2026-03-11; defines the OAuth credential form; registers three custom object types; wires the required Authenticate validation step to the hidden currentUser stream; documents setup and limitations.
Discovery streams and index mapping
plugins/Notion/v1/dataStreams/usersList.json, plugins/Notion/v1/dataStreams/dataSourcesSearch.json, plugins/Notion/v1/dataStreams/scripts/dataSourcesSearch.js, plugins/Notion/v1/dataStreams/pagesSearch.json, plugins/Notion/v1/dataStreams/scripts/pagesSearch.js, plugins/Notion/v1/indexDefinitions/default.json
Defines usersList, dataSourcesSearch, and pagesSearch data streams with paging and filtering behavior, plus scripts that flatten titles and apply scope filtering; maps each stream to users, data sources, and pages in the default index definition.
Data source detail streams
plugins/Notion/v1/dataStreams/dataSourceRows.json, plugins/Notion/v1/dataStreams/scripts/dataSourceRows.js, plugins/Notion/v1/dataStreams/dataSourceSchema.json, plugins/Notion/v1/dataStreams/scripts/dataSourceSchema.js
Adds dataSourceRows and dataSourceSchema streams for Notion Data Source objects, with scripts that flatten page properties into rows and extract schema field details.
Page detail streams
plugins/Notion/v1/dataStreams/pageProperties.json, plugins/Notion/v1/dataStreams/scripts/pageProperties.js, plugins/Notion/v1/dataStreams/pageContent.json, plugins/Notion/v1/dataStreams/scripts/pageContent.js, plugins/Notion/v1/dataStreams/pageComments.json, plugins/Notion/v1/dataStreams/scripts/pageComments.js
Adds pageProperties, pageContent, and pageComments streams for Notion Page objects, with scripts that flatten page properties, convert block children to rows, and normalize comment responses including 403 handling.
Default dashboards, scopes, and manifest
plugins/Notion/v1/defaultContent/manifest.json, plugins/Notion/v1/defaultContent/scopes.json, plugins/Notion/v1/defaultContent/overview.dash.json, plugins/Notion/v1/defaultContent/notionUser.dash.json, plugins/Notion/v1/defaultContent/notionDataSource.dash.json, plugins/Notion/v1/defaultContent/notionPage.dash.json
Declares the default dashboard manifest and three scope definitions, and adds four dashboard templates for overview, user, data source, and page views wired to the matching data streams.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: adding a new Notion plugin.
Description check ✅ Passed The description covers plugin overview, screenshots, testing, limitations, and checklist, which is mostly complete for a new plugin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands.

@clarkd clarkd added the new-plugin Used to PR newly added plugins label Jun 23, 2026
@clarkd clarkd requested a review from andrewmumblebee June 23, 2026 16:25

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/Notion/v1/dataStreams/dataSourceRows.json`:
- Line 30: The dataSourceRows stream currently declares timeframes as false on
line 30, but according to coding guidelines, non-time-based data streams must
explicitly expose "none" as the available timeframe to prevent UI warnings and
default-timeframe mismatches. Replace the timeframes property value from false
to an array containing the string "none" to properly declare explicit
no-timeframe support.
- Around line 24-25: The date-time fields lastEditedTime and createdTime in the
dataSourceRows.json configuration are incorrectly using the "date" semantic
shape when they should use "timestamp" instead. Update both field definitions to
change the shape property from "date" to "timestamp" to accurately represent
date-time values for proper downstream formatting and semantic handling.

In `@plugins/Notion/v1/dataStreams/dataSourceSchema.json`:
- Line 21: The timeframes property in the dataSourceSchema.json file for the
Notion data stream is set to false, but must be explicitly set to the string
value "none" to comply with coding guidelines and prevent UI warnings and
incorrect default behavior. Locate the timeframes property declaration and
change its value from false to "none".

In `@plugins/Notion/v1/dataStreams/dataSourcesSearch.json`:
- Line 28: The timeframes property in the dataSourcesSearch.json file is
currently set to the boolean value false, but it should explicitly declare
"none" as a string value instead. Change the timeframes property from false to
the string "none" to properly indicate that the data source does not support
time-based filtering and to comply with coding guidelines that prevent UI
warnings and incorrect default behavior.

In `@plugins/Notion/v1/dataStreams/pageComments.json`:
- Line 41: The pageComments.json stream currently sets timeframes to false,
which does not explicitly declare time-based filtering support and can cause UI
warnings and incorrect defaults. Replace the timeframes property value from
false to an explicit declaration of "none" to properly indicate that this stream
does not support time-based filtering. This aligns with the requirement that
non-time-based data streams must explicitly declare "none" as an available
timeframe.

In `@plugins/Notion/v1/dataStreams/pageContent.json`:
- Line 26: In the pageContent data stream configuration, locate the "timeframes"
property and replace the false value with an explicit "none" option. This
ensures the stream properly declares that it does not support time-based
filtering and aligns with the coding guidelines for data streams that don't
support time-based filtering.

In `@plugins/Notion/v1/dataStreams/pageProperties.json`:
- Line 24: The `timeframes` field in the pageProperties.json file is set to
`false`, which violates the stream contract for non-time-filterable streams and
can cause UI warnings. Replace the `timeframes: false` declaration with
`"timeframes": ["none"]` to explicitly declare that this stream does not support
time-based filtering, as required by the coding guidelines.

In `@plugins/Notion/v1/dataStreams/pagesSearch.json`:
- Line 39: The pagesSearch data stream in pagesSearch.json currently has
timeframes set to false on line 39, but according to coding guidelines, streams
that don't support time-based filtering must explicitly declare "none" as the
timeframe value instead of false. Change the value of the timeframes property
from false to the string "none" to comply with the guidelines and ensure proper
UI behavior without warnings.

In `@plugins/Notion/v1/dataStreams/usersList.json`:
- Line 27: In the usersList.json data stream configuration, change the
"timeframes" property from the boolean value false to the string value "none".
This explicitly declares that the stream does not support time-based filtering,
which aligns with the coding guidelines and prevents UI warnings and incorrect
default behavior.

In `@plugins/Notion/v1/docs/README.md`:
- Around line 1-52: In the Known limitations section, locate the Page volume
bullet point which currently states "workspaces with large databases can import
a very large number of `Notion Page` objects" and replace the weak intensifier
phrase "very large number" with a stronger, more direct term such as "many" or
"considerable number" to make the statement clearer and more impactful.

In `@plugins/Notion/v1/ui.json`:
- Around line 3-4: The clientId field in the ui.json configuration lacks a
required placeholder attribute. For the clientId field object (which currently
has name and label properties), add a new placeholder property with a
descriptive example value such as "Enter your Notion client ID" to meet the
guidelines requirement that all text fields include placeholders for better user
guidance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1d2086e9-5eec-4b06-ad09-1763c2b3d7dd

📥 Commits

Reviewing files that changed from the base of the PR and between f166881 and d0c24c0.

⛔ Files ignored due to path filters (1)
  • plugins/Notion/v1/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (29)
  • plugins/Notion/v1/configValidation.json
  • plugins/Notion/v1/custom_types.json
  • plugins/Notion/v1/dataStreams/currentUser.json
  • plugins/Notion/v1/dataStreams/dataSourceRows.json
  • plugins/Notion/v1/dataStreams/dataSourceSchema.json
  • plugins/Notion/v1/dataStreams/dataSourcesSearch.json
  • plugins/Notion/v1/dataStreams/pageComments.json
  • plugins/Notion/v1/dataStreams/pageContent.json
  • plugins/Notion/v1/dataStreams/pageProperties.json
  • plugins/Notion/v1/dataStreams/pagesSearch.json
  • plugins/Notion/v1/dataStreams/scripts/currentUser.js
  • plugins/Notion/v1/dataStreams/scripts/dataSourceRows.js
  • plugins/Notion/v1/dataStreams/scripts/dataSourceSchema.js
  • plugins/Notion/v1/dataStreams/scripts/dataSourcesSearch.js
  • plugins/Notion/v1/dataStreams/scripts/pageComments.js
  • plugins/Notion/v1/dataStreams/scripts/pageContent.js
  • plugins/Notion/v1/dataStreams/scripts/pageProperties.js
  • plugins/Notion/v1/dataStreams/scripts/pagesSearch.js
  • plugins/Notion/v1/dataStreams/usersList.json
  • plugins/Notion/v1/defaultContent/manifest.json
  • plugins/Notion/v1/defaultContent/notionDataSource.dash.json
  • plugins/Notion/v1/defaultContent/notionPage.dash.json
  • plugins/Notion/v1/defaultContent/notionUser.dash.json
  • plugins/Notion/v1/defaultContent/overview.dash.json
  • plugins/Notion/v1/defaultContent/scopes.json
  • plugins/Notion/v1/docs/README.md
  • plugins/Notion/v1/indexDefinitions/default.json
  • plugins/Notion/v1/metadata.json
  • plugins/Notion/v1/ui.json

Comment thread plugins/Notion/v1/dataStreams/dataSourceRows.json
Comment thread plugins/Notion/v1/dataStreams/dataSourceRows.json
Comment thread plugins/Notion/v1/dataStreams/dataSourceSchema.json
Comment thread plugins/Notion/v1/dataStreams/dataSourcesSearch.json
Comment thread plugins/Notion/v1/dataStreams/pageComments.json
Comment thread plugins/Notion/v1/dataStreams/pageProperties.json
Comment thread plugins/Notion/v1/dataStreams/pagesSearch.json
Comment thread plugins/Notion/v1/dataStreams/usersList.json
Comment thread plugins/Notion/v1/docs/README.md
Comment thread plugins/Notion/v1/ui.json
Comment thread plugins/Notion/v1/docs/README.md Outdated
@andrewmumblebee

andrewmumblebee commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The OOB dashboards seem blank for Data Source and Page, they do have content for me in Notion though.

image image image image

EDIT

I may have missed something, after clicking to allow everything in Notion it worked, but did index 900 pages 😆 now they work. Does it need every single page in a data source to be able to show it in the OOB dashboard?

image

I also didn't scroll down on the OOB dashboard, so missed there were additional tiles.

Perhaps on the Data source OOB dashboard, the contents tile should be first or next to the properties

@clarkd

clarkd commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

The OOB dashboards seem blank for Data Source and Page, they do have content for me in Notion though.

image image image image
EDIT

I may have missed something, after clicking to allow everything in Notion it worked, but did index 900 pages 😆 now they work. Does it need every single page in a data source to be able to show it in the OOB dashboard?

image I also didn't scroll down on the OOB dashboard, so missed there were additional tiles.

Perhaps on the Data source OOB dashboard, the contents tile should be first or next to the properties

In Notion, you either have to add a connector to a page via the menu, or when installing the integration you can select pages/data sources - so I think this was likely the issue here. It's noted in the README but isn't super clear. I'll reword & add a screenshot.

@github-actions

Copy link
Copy Markdown

🧩 Plugin PR Summary

📦 Modified Plugins

  • plugins/Notion/v1

📋 Results

Step Status
Validation ✅ Passed
Deployment 🚀 Deployed

🔍 Validation Details

notion
{
  "valid": true,
  "pluginName": "notion",
  "pluginType": "hybrid",
  "summary": {
    "Data Streams": 9,
    "Import Definitions": 1,
    "UI Configuration": true,
    "Has Icon": true,
    "Has Default Content": true,
    "Config Validation": true,
    "Custom Types": true
  }
}

@clarkd clarkd requested a review from andrewmumblebee June 25, 2026 15:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
plugins/Notion/v1/docs/README.md (1)

17-32: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use the public-connection setup flow here.

Notion's current docs say public connections are created in the Developer portal, require an installation scope, and use the OAuth page picker; the manual Connections → Connect to flow is for internal connections. As written, this section sends users through the wrong setup path and can leave the plugin without the pages it expects. (developers.notion.com)

Suggested rewrite
-1. Go to [Notion → My integrations](https://www.notion.so/my-integrations) and click **New connection**.
-2. Give it a name (e.g. *SquaredUp*) and associate it with the workspace you want to monitor.
-3. Select OAuth as the Authentication method
-4. If required, select a specific workspace.
-5. Under **Redirect URIs**, add the SquaredUp redirect URI for your region — copy the one that matches your tenant:
+1. Go to Notion's Developer portal → **Public connections** → **Create new connection**.
+2. Enter the connection name, development workspace, redirect URI(s), installation scope, and capabilities.
+3. Copy the **Client ID** and **Client Secret** from the **Configuration** tab.
...
-Notion only returns content that has been explicitly shared with the integration. In each page or database you want monitored, open the **•••** menu → **Connections** → **Connect to** → select your integration.
+During the OAuth flow, select the pages/databases you want the connection to access.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/Notion/v1/docs/README.md` around lines 17 - 32, The Notion setup
steps in the README are using the manual internal-connection flow, but this
plugin needs the public connection/OAuth flow instead. Update the instructions
in the Notion docs section to reference the Developer portal public integration
setup, the required installation scope, and the OAuth page picker, and remove or
replace the “Connections → Connect to” sharing guidance so it matches the public
connection behavior for the plugin.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@plugins/Notion/v1/docs/README.md`:
- Around line 17-32: The Notion setup steps in the README are using the manual
internal-connection flow, but this plugin needs the public connection/OAuth flow
instead. Update the instructions in the Notion docs section to reference the
Developer portal public integration setup, the required installation scope, and
the OAuth page picker, and remove or replace the “Connections → Connect to”
sharing guidance so it matches the public connection behavior for the plugin.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9fd6a692-72e4-4d74-930b-90363795b759

📥 Commits

Reviewing files that changed from the base of the PR and between 5664541 and 94c60ee.

📒 Files selected for processing (1)
  • plugins/Notion/v1/docs/README.md

@TimWheeler-SQUP TimWheeler-SQUP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed not tested, one nit, should the codeowners file be updated with the new plugin?
Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-plugin Used to PR newly added plugins

Development

Successfully merging this pull request may close these issues.

3 participants