You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
18869 feature upgrade notion create page in data source action to support templates (#18888)
* Enhance Notion component with template support and version updates
- Added `listTemplates` method to the Notion client for retrieving available templates.
- Updated `create-page-from-database` action to support template selection, including new properties for template type and ID.
- Bumped version to 2.0.0 for the `create-page-from-database` action and updated package version to 1.0.6.
- Upgraded `@notionhq/client` dependency to version 5.3.0.
* pnpm update
* Update Notion component versions to latest releases
- Bumped versions for multiple actions and sources, including `append-block`, `complete-file-upload`, `create-comment`, `create-database`, `create-file-upload`, `create-page`, `delete-block`, `duplicate-page`, `get-current-user`, `list-all-users`, `list-file-uploads`, `query-database`, `retrieve-block`, `retrieve-database-content`, `retrieve-database-schema`, `retrieve-file-upload`, `retrieve-page`, `retrieve-page-property-item`, `retrieve-user`, `search`, `send-file-upload`, `update-block`, `update-database`, `update-page`, and various sources.
- Ensured all components are aligned with the latest API specifications.
* Refactor template retrieval in create-page-from-database action
- Updated the `listTemplates` method call to use a parameters object for improved readability and maintainability.
- Added support for optional `start_cursor` parameter to handle pagination when retrieving templates.
Copy file name to clipboardExpand all lines: components/notion/actions/append-block/append-block.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ export default {
7
7
key: "notion-append-block",
8
8
name: "Append Block to Parent",
9
9
description: "Append new and/or existing blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)",
Copy file name to clipboardExpand all lines: components/notion/actions/complete-file-upload/complete-file-upload.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ export default {
6
6
key: "notion-complete-file-upload",
7
7
name: "Complete File Upload",
8
8
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)",
Copy file name to clipboardExpand all lines: components/notion/actions/create-comment/create-comment.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ export default {
5
5
key: "notion-create-comment",
6
6
name: "Create Comment",
7
7
description: "Create a comment in a page or existing discussion thread. [See the documentation](https://developers.notion.com/reference/create-a-comment)",
description: "Create a page from a data source. [See the documentation](https://developers.notion.com/reference/post-page)",
12
-
version: "1.1.0",
13
+
version: "2.0.0",
13
14
annotations: {
14
15
destructiveHint: false,
15
16
openWorldHint: true,
@@ -25,13 +26,26 @@ export default {
25
26
],
26
27
label: "Parent Data Source ID",
27
28
description: "Select a parent data source or provide a data source ID",
28
-
reloadProps: true,
29
29
},
30
-
Name: {
30
+
templateType: {
31
31
type: "string",
32
-
label: "Name",
33
-
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.",
34
-
optional: true,
32
+
label: "Template Type",
33
+
description: "The type of template to use for the page. [See the documentation](https://developers.notion.com/docs/creating-pages-from-templates) for more information.",
34
+
options: [
35
+
{
36
+
label: "No template. Provided children and properties are immediately applied.",
37
+
value: "none",
38
+
},
39
+
{
40
+
label: "Applies the data source's default template to the newly created page. `children` cannot be specified in the create page request.",
41
+
value: "default",
42
+
},
43
+
{
44
+
label: "Indicates which exact template to apply to the newly created page. children cannot be specified in the create page request.",
content: "This action will create an empty page by default. To add content, use the `Page Content` prop below.",
98
+
},
99
+
...this.buildAdditionalProps({
100
+
properties: selectedProperties,
101
+
}),
102
+
};
103
+
case"default":
104
+
return{
105
+
alert: {
106
+
type: "alert",
107
+
alertType: "info",
108
+
content: "This action will create a page using the data source's default template. Using the `Page Content` prop below will `not` apply to the page.",
109
+
},
110
+
};
111
+
case"template_id":
112
+
return{
113
+
templateId: {
114
+
type: "string",
115
+
label: "Template ID",
116
+
description: "The ID of the template to use for the page. [See the documentation](https://developers.notion.com/docs/creating-pages-from-templates) for more information.",
117
+
options: async({ prevContext })=>{
118
+
constparams={
119
+
data_source_id: this.parentDataSource,
120
+
};
121
+
if(prevContext?.nCursor){
122
+
params.start_cursor=prevContext.nCursor;
123
+
}
124
+
const{
125
+
templates,next_cursor: nCursor,
126
+
}=awaitthis.notion.listTemplates(params);
127
+
return{
128
+
options: templates.map(({
129
+
name: label,id: value,
130
+
})=>({
131
+
label,
132
+
value,
133
+
})),
134
+
context: {
135
+
nCursor,
136
+
},
137
+
};
138
+
},
139
+
},
140
+
alert: {
141
+
type: "alert",
142
+
alertType: "info",
143
+
content: "This action will create a page using the selected template. Using the `Page Content` prop below will `not` apply to the page.",
Copy file name to clipboardExpand all lines: components/notion/actions/delete-block/delete-block.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ export default {
6
6
key: "notion-delete-block",
7
7
name: "Delete Block",
8
8
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)",
Copy file name to clipboardExpand all lines: components/notion/actions/get-current-user/get-current-user.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ export default {
4
4
key: "notion-get-current-user",
5
5
name: "Get Current User",
6
6
description: "Retrieve the Notion identity tied to the current OAuth token, returning the full `users.retrieve` payload for `me` (person or bot). Includes the user ID, name, avatar URL, type (`person` vs `bot`), and workspace ownership metadata—useful for confirming which workspace is connected, adapting downstream queries, or giving an LLM the context it needs about who is operating inside Notion. [See the documentation](https://developers.notion.com/reference/get-user).",
0 commit comments