docs/versioned_docs/version-3.0.0-LTS/data-sources/notion.md
ToolJet can connect to a Notion workspace to do operations on notion pages, databases, users and blocks.
<div style={{paddingTop:'24px'}}>To establish a connection with the Notion data source, click on the + Add new Data source button located on the query panel or navigate to the Data Sources page from the ToolJet dashboard.
For integrating Notion with ToolJet we will need the API token. The API token can be generated from your Notion workspace settings. Read the official Notion docs for Creating an internal integration with notion API.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px'}}>Notion API provides support for:
:::info Database ID, View ID and Page ID can be found using notion workspace URL.
For example:
URL: https://www.notion.so/workspace/XXX?v=YYY&p=ZZZ
Here:
XXX is the Database IDYYY is the View IDZZZ is the Page ID:::
:::tip
Before querying Notion, you must share the database with your integration. Click the share button in your database view, find your integration name select it.
:::
</div> <div style={{paddingTop:'24px'}}>On database resource you can perform the following operations:
This operations retrieves a Database object using the ID specified.
This operation gets a list of Pages contained in the database, filtered and ordered according to the filter conditions and sort criteria provided in the query.
This operation creates a database as a subpage in the specified parent page, with the specified properties.
[
{
"type": "text",
"text": {
"content": "Project Tasks Database",
"link": null
}
}
]
{
"Task Name": {
"title": {}
},
"Due Date": {
"date": {}
},
"Completed": {
"checkbox": {}
}
}
This operation updates an existing database as specified by the parameters.
[
{
"type": "text",
"text": {
"content": "Updated Tasks Database"
}
}
]
{
"Priority": {
"select": {
"options": [
{ "name": "High", "color": "red" },
{ "name": "Medium", "color": "yellow" },
{ "name": "Low", "color": "green" }
]
}
},
"Assigned To": {
"people": {}
}
}
On page resource you can perform the following operations:
This operation retrieves a Page object using the ID specified.
This operation creates a new page in the specified database or as a child of an existing page. If the parent is a database, the property values of the new page in the properties parameter must conform to the parent database's property schema. If the parent is a page, the only valid property is title.
{
"Title": {
"title": [
{
"type": "text",
"text": {
"content": "New Page Title"
}
}
]
}
}
This operation updates page property values for the specified page. Properties that are not set via the properties parameter will remain unchanged.
{
"Title": {
"title": [
{
"type": "text",
"text": {
"content": "Updated Page Title"
}
}
]
},
"Status": {
"select": {
"name": "In Progress"
}
}
}
This operation retrieves a property_item object for a given page ID and property ID. Depending on the property type, the object returned will either be a value or a paginated list of property item values. See Property item objects for specifics.
This operation archive or un archive the page specified using Page ID.
The following operations can be performed on the block resource:
:::info
To get the id for blocks, simply click on the menu icon for the block and click "Copy link". Afterwards, paste the link in the browser and it should look like this: https://www.notion.so/Creating-Page-Sample-ee18b8779ae54f358b09221d6665ee15#7fcb3940a1264aadb2ad4ee9ffe11b0e the string after # is the block id i.e. 7fcb3940a1264aadb2ad4ee9ffe11b0e.
:::
This operation retrieves a Block object using the ID specified.
This operation creates and appends new children blocks to the parent block_id specified.
This operation retrieves a paginated array of child block objects contained in the block using the ID specified.
This operation updates the content for the specified block_id based on the block type.
{
"Title": {
"title": [
{
"type": "text",
"text": {
"content": "Updated Page Title"
}
}
]
},
"Status": {
"select": {
"name": "In Progress"
}
}
}
The following operations can be performed on the user notion resource:
This operation retrieves a User using the ID specified.
This operation returns a paginated list of Users for the workspace.