Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/notion/actions/append-block/append-block.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Append Block to Parent",
description:
"Append new and/or existing blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)",
version: "0.3.7",
version: "0.3.8",
type: "action",
props: {
notion,
Expand Down
75 changes: 54 additions & 21 deletions components/notion/actions/common/base-page-builder.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { markdownToBlocks } from "@tryfabric/martian";
import {
NOTION_DATABASE_META,
NOTION_DATA_SOURCE_META,
NOTION_PAGE_META,
} from "../../common/notion-meta-properties.mjs";
import NOTION_META from "../../common/notion-meta-selection.mjs";
Expand All @@ -10,7 +10,7 @@ export default {
methods: {
/**
* Creates additional props for page properties and the selected block children
* @param properties - The selected (database) properties from the page obtained from Notion
* @param properties - The selected (data source) properties from the page obtained from Notion
* @param meta - The selected meta properties
* @param blocks - The selected block children from the workflow UI
* @returns additional props
Expand Down Expand Up @@ -74,7 +74,8 @@ export default {
* @param properties - Properties from the selected page obtained from Notion
* @returns the selected props inputted by the user with the following attributes:
* - type: the Notion property type used in notion-page-properties.mjs
* - label: the page's property name
* - label: the property ID for API calls
* (was property name before data source migration)
* - value: the property value inputted by the user
*/
_filterProps(properties = {}) {
Expand All @@ -83,7 +84,7 @@ export default {
|| (this.properties && this.properties[property]))
.map((property) => ({
type: properties[property]?.type ?? property,
label: property,
label: properties[property]?.id || property,
value: this[property] || this.properties?.[property],
}));
},
Expand All @@ -96,20 +97,26 @@ export default {
_convertPropertiesToNotion(properties = [], NOTION_CONVERTER = {}) {
const notionProperties = {};
for (const property of properties) {
const notionProperty = NOTION_CONVERTER[property.type];
notionProperties[property.label] = notionProperty?.convertToNotion(property);
// If the property value is already in Notion format, use it directly
if (this._isAlreadyNotionFormat(property.value, property.type)) {
notionProperties[property.label] = property.value;
} else {
// Otherwise, convert using the appropriate converter
const notionProperty = NOTION_CONVERTER[property.type];
notionProperties[property.label] = notionProperty?.convertToNotion(property);
}
}
return notionProperties;
},
/**
* Builds page meta properties (parent, icon, cover, archived) from a parent database
* Builds page meta properties (parent, icon, cover, archived) from a parent data source
* Uses the property label as its type to be able to select in notion-meta-properties.mjs
* @param properties - list of Notion page properties inputted by the user
* @returns the meta properties in Notion format inputted by the user
*/
_buildNotionDatabaseMeta(properties = []) {
_buildNotionDataSourceMeta(properties = []) {
properties.forEach((property) => property.type = property.label);
return this._convertPropertiesToNotion(properties, NOTION_DATABASE_META);
return this._convertPropertiesToNotion(properties, NOTION_DATA_SOURCE_META);
},
/**
* Builds page meta properties (parent, icon, cover, archived) from a parent page
Expand All @@ -122,21 +129,21 @@ export default {
return this._convertPropertiesToNotion(properties, NOTION_PAGE_META);
},
/**
* Builds page properties from a parent database/page
* Builds page properties from a parent data source/page
* @param properties - list of Notion page properties inputted by the user
* @returns the properties in Notion format inputted by the user
*/
_buildNotionPageProperties(properties = []) {
return this._convertPropertiesToNotion(properties, NOTION_PAGE_PROPERTIES);
},
/**
* Builds the page meta inputted by the user in Notion format from a parent database
* @param parentDatabase - the parent database that contains the meta properties
* Builds the page meta inputted by the user in Notion format from a parent data source
* @param parentDataSource - the parent data source that contains the meta properties
* @returns the meta properties in Notion format
*/
buildDatabaseMeta(parentDatabase) {
const filteredMeta = this._filterProps(parentDatabase);
return this._buildNotionDatabaseMeta(filteredMeta);
buildDataSourceMeta(parentDataSource) {
const filteredMeta = this._filterProps(parentDataSource);
return this._buildNotionDataSourceMeta(filteredMeta);
},
/**
* Builds the page meta inputted by the user in Notion format from a parent page
Expand All @@ -156,6 +163,32 @@ export default {
const filteredProperties = this._filterProps(parentProperties);
return this._buildNotionPageProperties(filteredProperties);
},
/**
* Checks if a property value is already in Notion format
* @param value - the property value to check
* @returns true if already in Notion format, false otherwise
*/
_isAlreadyNotionFormat(value) {
if (!value || typeof value !== "object") return false;

// Check for common Notion property structures
const notionKeys = [
"title",
"rich_text",
"number",
"select",
"multi_select",
"date",
"people",
"files",
"checkbox",
"url",
"email",
"phone_number",
"relation",
];
return notionKeys.some((key) => key in value);
},
/**
* Creates the block children inputted by the user in Notion format
* @returns the block children in Notion format
Expand Down Expand Up @@ -210,13 +243,13 @@ export default {
},
};
},
childDatabaseToLink(block) {
childDataSourceToLink(block) {
return {
object: "block",
type: "link_to_page",
link_to_page: {
type: "database_id",
database_id: block.id,
type: "data_source_id",
data_source_id: block.id,
},
Comment on lines +246 to 253
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm Notion supports link_to_page with data_source_id.

The new child type child_data_source likely maps to link_to_page: { type: "data_source_id", data_source_id }, but this API is very new. Please verify against the 2025‑09‑03 docs.


🌐 Web query:

Notion link_to_page supports which types as of 2025-09-03? Is `data_source_id` a valid type alongside `page_id` and `database_id`? Provide the exact docs section.

💡 Result:

Answer: As of 2025-09-03, the link_to_page block supports only type = "page_id" and type = "database_id". data_source_id is not listed as a valid link_to_page type. See the "Link to Page block type" section showing examples using page_id and database_id [1], and the 2025-09-03 changelog note about databases/data_sources (no change adding data_source_id to link_to_page) [2].

Sources:
[1] Notion Developers — "Synced Block, Link to Page and Template block types are now supported in the API" — Link to Page block type (example uses "type": "page_id" and mentions "database_id"). (developers.notion.com)
[2] Notion Developers — "Changes by version" (2025-09-03 entry describing /v1/databases → /v1/data_sources reorganization). (developers.notion.com)

Citations:


Replace/remove unsupported link_to_page type "data_source_id" — Notion docs (2025-09-03) list only "page_id" and "database_id".

File: components/notion/actions/common/base-page-builder.mjs
Lines: 213-220

    childDataSourceToLink(block) {
      return {
        object: "block",
        type: "link_to_page",
        link_to_page: {
          type: "data_source_id",
          data_source_id: block.id,
        },

Notion docs (Link to Page block type, 2025-09-03) do not list data_source_id; change this to use a supported type (page_id or database_id) or remove/replace the child_data_source code path and verify block.id maps to the chosen id.

🤖 Prompt for AI Agents
components/notion/actions/common/base-page-builder.mjs lines 213-220: The code
returns a link_to_page object with unsupported type "data_source_id"; update
this to a supported Notion type (either "page_id" or "database_id") or remove
the childDataSourceToLink path. Replace link_to_page.type with the chosen
supported type and rename the id property accordingly (e.g., use link_to_page: {
type: "page_id", page_id: block.id } or { type: "database_id", database_id:
block.id }), and ensure block.id actually contains the corresponding page or
database id; if block.id cannot be mapped reliably, remove/disable this code
path and add a comment explaining why.

};
},
Expand All @@ -236,9 +269,9 @@ export default {
if (child.type === "child_page") {
// convert child pages to links
children[i] = this.childPageToLink(child);
} else if (child.type === "child_database") {
// convert child databases to links
children[i] = this.childDatabaseToLink(child);
} else if (child.type === "child_data_source") {
// convert child data sources to links
children[i] = this.childDataSourceToLink(child);
} else {
if (this.notValid(child, c)) {
children[i] = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "notion-complete-file-upload",
name: "Complete File Upload",
description: "Use this action to finalize a `mode=multi_part` file upload after all of the parts have been sent successfully. [See the documentation](https://developers.notion.com/reference/complete-a-file-upload)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
key: "notion-create-comment",
name: "Create Comment",
description: "Create a comment in a page or existing discussion thread. [See the documentation](https://developers.notion.com/reference/create-a-comment)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 12 in components/notion/actions/create-comment/create-comment.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 12 in components/notion/actions/create-comment/create-comment.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Provide either a Page ID or a Discussion ID to create the comment under.",
Expand Down
8 changes: 5 additions & 3 deletions components/notion/actions/create-database/create-database.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
...base,
key: "notion-create-database",
name: "Create Database",
description: "Create a database. [See the documentation](https://developers.notion.com/reference/create-a-database)",
version: "0.0.2",
description: "Create a database and its initial data source. [See the documentation](https://developers.notion.com/reference/database-create)",
version: "0.1.0",
type: "action",
props: {
notion,
Expand Down Expand Up @@ -45,7 +45,9 @@ export default {
},
},
],
properties: utils.parseObject(this.properties),
initial_data_source: {
properties: utils.parseObject(this.properties),
},
});

$.export("$summary", `Successfully created database with ID ${response.id}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "notion-create-file-upload",
name: "Create File Upload",
description: "Create a file upload. [See the documentation](https://developers.notion.com/reference/create-a-file-upload)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
notion,
Expand Down
20 changes: 10 additions & 10 deletions components/notion/actions/create-page-from-database/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Overview

The Notion Create Page from Database action allows you to add pages to a Notion Database.
The Notion Create Page from Data Source action allows you to add pages to a Notion Data Source.

This action features easy to use dropdowns that automatically populate your databases as well as your database's properties, also known as columns.
This action features easy to use dropdowns that automatically populate your data source as well as your data source's properties, also known as columns.

This action interacts with the [Notion create a Page API endpoint](https://developers.notion.com/reference/post-page). The Database selected in the `Parent Database ID` is used as the `parent_id` parameter to that endpoint so the page is added to your databaset .
This action interacts with the [Notion create a Page API endpoint](https://developers.notion.com/reference/post-page). The Data Source selected in the `Parent Data Source ID` is used as the `parent_id` parameter to that endpoint so the page is added to your data source.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

API terminology: Notion uses a parent object, not parent_id.
Reflect the current API (parent: { data_source_id: ... }).

-...used as the `parent_id` parameter to that endpoint...
+...used in the `parent` object (e.g., `parent: { data_source_id: "<ID>" }`) for that endpoint...
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
This action interacts with the [Notion create a Page API endpoint](https://developers.notion.com/reference/post-page). The Data Source selected in the `Parent Data Source ID` is used as the `parent_id` parameter to that endpoint so the page is added to your data source.
This action interacts with the [Notion create a Page API endpoint](https://developers.notion.com/reference/post-page). The Data Source selected in the `Parent Data Source ID` is used in the `parent` object (e.g., `parent: { data_source_id: "<ID>" }`) for that endpoint so the page is added to your data source.
🤖 Prompt for AI Agents
In components/notion/actions/create-page-from-database/README.md around line 7,
update the wording to use Notion's current API terminology: refer to a "parent"
object rather than "parent_id". Change the description to explain that the
selected Data Source ID is provided as parent: { data_source_id: "<id>" } (or
equivalent) so the page is added to that data source, and ensure examples and
parameter names in the README reflect "parent" with a nested data_source_id
field.


# Getting Started

<iframe width="560" height="315" src="https://www.youtube.com/embed/wciWsu564_0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

[Follow this short 4 minute guide to connect your Notion account and add new Database pages](https://youtu.be/wciWsu564_0)
[Follow this short 4 minute guide to connect your Notion account and add new Data Source pages](https://youtu.be/wciWsu564_0) (note: as of 2025-09-02, Databases are divided into multiple Data Sources, which are the entities that contain the pages)

### Props

When using the **Create Page from Database** action, there are several props to define:
When using the **Create Page from Data Source** action, there are several props to define:

1. `Notion Account` - see the **Accounts** section below.
2. `Parent Database ID` - the database to add a page to.
2. `Parent Data Source ID` - the data source to add a page to.
3. `Meta Types` - an icon or cover to add to the new page (optional).
4. `Property Types` - one or more properties to add to the new page that correspond with columns in the database.
4. `Property Types` - one or more properties to add to the new page that correspond with columns in the data source.
5. `Page Content` - the content of the page that appears when it's opened in a side view.

Each selected `Property Type` will also add a new prop for that given column.
Expand All @@ -37,12 +37,12 @@ Each selected `Property Type` will also add a new prop for that given column.
1. [Create a new workflow](https://pipedream.com/new).
2. Select your trigger (HTTP, Cron, etc.).
3. Click on the **+** button below the trigger step, and search for "Notion".
4. Select the **Create Page from Database** action.
4. Select the **Create Page from Data Source** action.
5. Click the **Connect Account** button near the top of the step. This will prompt you to select any existing Notion accounts you've previously authenticated with Pipedream, or you can select a **New** account. Clicking **New** opens a new window asking you to allow Pipedream access to your Notion workspaces and pages. Choose the workspaces and pages where you'd like to install the app, then click **Allow**.
6. That's it! You can now connect to the Notion API using any of the Slack actions within a Pipedream workflow.

# Troubleshooting

If your database doesn't appear under the options, try deleting your Notion account connection and reconnecting.
If your data source doesn't appear under the options, try deleting your Notion account connection and reconnecting.

There's an issue with Notion Databases not appearing in the options if the Database was created _after_ you connected your Notion account to Pipedream.
There's an issue with Notion Data Sources not appearing in the options if the Data Source was created _after_ you connected your Notion account to Pipedream.
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
export default {
...base,
key: "notion-create-page-from-database",
name: "Create Page from Database",
description: "Create a page from a database. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.2.4",
name: "Create Page from Data Source",
description: "Create a page from a data source. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "1.0.0",
type: "action",
props: {
notion,
parent: {
parentDataSource: {
propDefinition: [
notion,
"databaseId",
"dataSourceId",
],
label: "Parent Database ID",
description: "Select a parent database or provide a database ID",
label: "Parent Data Source ID",
description: "Select a parent data source or provide a data source ID",
},
Name: {
type: "string",
label: "Name",
description: "The name of the page. Use this only if the database has a `title` property named `Name`. Otherwise, use the `Properties` prop below to set the title property.",
description: "The name of the page. Use this only if the data source has a `title` property named `Name`. Otherwise, use the `Properties` prop below to set the title property.",
optional: true,
},
properties: {
type: "object",
label: "Properties",
description: "The values of the page's properties. The schema must match the parent database's properties. [See the documentation](https://developers.notion.com/reference/property-object) for information on various property types. Example: `{ \"Tags\": [ \"tag1\" ], \"Link\": \"https://pipedream.com\" }`",
description: "The values of the page's properties. The schema must match the parent data source's properties. [See the documentation](https://developers.notion.com/reference/property-object) for information on various property types. Example: `{ \"Tags\": [ \"tag1\" ], \"Link\": \"https://pipedream.com\" }`",
optional: true,
},
icon: {
Expand All @@ -45,7 +45,7 @@
description: "Cover [External URL](https://developers.notion.com/reference/file-object#external-file-objects)",
optional: true,
},
alert: {

Check warning on line 48 in components/notion/actions/create-page-from-database/create-page-from-database.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 48 in components/notion/actions/create-page-from-database/create-page-from-database.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "This action will create an empty page by default. To add content, use the `Page Content` prop below.",
Expand All @@ -60,14 +60,14 @@
methods: {
...base.methods,
/**
* Builds a page from a parent database
* @param parentDatabase - the parent database
* Builds a page from a parent data source
* @param parentDataSource - the parent data source
* @returns the constructed page in Notion format
*/
buildPage(parentDatabase) {
const meta = this.buildDatabaseMeta(parentDatabase);
buildPage(parentDataSource) {
const meta = this.buildDataSourceMeta(parentDataSource);
this.properties = utils.parseObject(this.properties);
const properties = this.buildPageProperties(parentDatabase.properties);
const properties = this.buildPageProperties(parentDataSource.properties);
const children = this.createBlocks(this.pageContent);
return {
...meta,
Expand All @@ -78,7 +78,7 @@
},
async run({ $ }) {
const MAX_BLOCKS = 100;
const parentPage = await this.notion.retrieveDatabase(this.parent);
const parentPage = await this.notion.retrieveDataSource(this.parentDataSource);
const {
children, ...page
} = this.buildPage(parentPage);
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/create-page/create-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-create-page",
name: "Create Page",
description: "Create a page from a parent page. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.2.20",
version: "0.2.21",
type: "action",
props: {
notion,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/delete-block/delete-block.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
key: "notion-delete-block",
name: "Delete Block",
description: "Sets a Block object, including page blocks, to archived: true using the ID specified. [See the documentation](https://developers.notion.com/reference/delete-a-block)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 13 in components/notion/actions/delete-block/delete-block.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 13 in components/notion/actions/delete-block/delete-block.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "**Note:** In the Notion UI application, this moves the block to the \"Trash\" where it can still be accessed and restored.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-duplicate-page",
name: "Duplicate Page",
description: "Create a new page copied from an existing page block. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "notion-list-all-users",
name: "List All Users",
description: "Returns all users in the workspace. [See the documentation](https://developers.notion.com/reference/get-users)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "notion-list-file-uploads",
name: "List File Uploads",
description: "Use this action to list file uploads. [See the documentation](https://developers.notion.com/reference/list-file-uploads)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
notion,
Expand Down
Loading
Loading