# Notion

> Connect to Notion to search content, look up items in databases, and create or update pages.

App · Notes · 7 actions · 1 trigger. Web page: https://docs.lodol.com/docs/integrations/notion

## Triggers

Start a workflow when something happens in Notion. See [how triggers work](https://docs.lodol.com/docs/concepts/triggers.md).

### Notion New Page

Triggers when a new page is added to a Notion database

**Filters**: Narrow which events start a run.

- `database_id` (required)
- `title`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `id` (text)
- `title` (text)
- `url` (text)
- `last_edited_time` (text)

## Actions

### Add content to a page

Add content blocks to an existing Notion page or block.

**Inputs**

- Page or block ID (`block_id`, text, required): The ID of the page or block to add content to. To add to a page, use the page ID from 'Create page in database' or 'Retrieve page details'.
- Content blocks (`children`, list, required): Content blocks to add, in Notion's block format. Each block needs a 'type' field and a matching object of that type containing a 'rich_text' list.

**Outputs**

- `appended` (number): Number of blocks appended.
- `has_more` (true/false): Whether more blocks exist.
- `next_cursor` (text): Cursor for additional blocks.
- `status` (text): Action execution status.

**Example output**

```json
{
  "appended": 3,
  "has_more": false,
  "next_cursor": null,
  "status": "success"
}
```

### Create page in database

Create a new page in a Notion database, with optional content blocks.

**Inputs**

- Parent database ID (`parent_database_id`, text, required): The ID of the database to create the page in. Use the 'List databases' action first to find available database IDs.
- Title (`title`, text, required): Page title.
- Properties (`properties`, object): Additional page properties.
- Content blocks (`children`, list): Content blocks to add to the page, in Notion's block format. Each block needs a 'type' field and a matching object of that type containing a 'rich_text' list.
- Title property (`title_property`, text): The name of the database's title property, if it is not 'Name'.

**Outputs**

- `id` (text): Created page ID.
- `status` (text): Action execution status.
- `title` (text): Created page title.
- `url` (text): Created page URL.

**Example output**

```json
{
  "id": "n7m8l9k0j1i2",
  "status": "success",
  "title": "New Page",
  "url": "https://www.notion.so/New-Page-n7m8l9k0j1i2"
}
```

### Find pages in a database

Find pages in a Notion database, with optional filters and sorting.

**Inputs**

- Database ID (`database_id`, text, required): Database ID.
- Filter (`filter`, object): Conditions the pages must match, in Notion's filter format.
- Sorts (`sorts`, list): How to order the results, in Notion's sort format.
- Number of results (`page_size`, number): Number of results to return.
- Start from (`start_cursor`, text): Leave blank for the first set of results. To get more, use the next cursor value from the previous run.

**Outputs**

- `count` (number): Number of results returned.
- `has_more` (true/false): Whether more results are available.
- `next_cursor` (text): Cursor for next page.
- `results` (list): Array of page objects from query.
- `status` (text): Action execution status.

**Example output**

```json
{
  "count": 1,
  "has_more": false,
  "next_cursor": null,
  "results": [
    {
      "id": "p1q2r3s4t5u6",
      "last_edited_time": "2024-01-15T14:20:00.000Z",
      "properties": {
        "Name": "Task 1",
        "Status": "In Progress"
      },
      "title": "Task 1",
      "url": "https://www.notion.so/Task-1-p1q2r3s4t5u6"
    }
  ],
  "status": "success"
}
```

### List databases

List the Notion databases you can access, with an optional search to narrow the results.

**Inputs**

- Query (`query`, text): What to search for.
- Number of results (`page_size`, number): Number of results to return.
- Start from (`start_cursor`, text): Leave blank for the first set of results. To get more, use the next cursor value from the previous run.

**Outputs**

- `count` (number): Number of databases returned.
- `databases` (list): Array of Notion database objects.
- `has_more` (true/false): Whether more databases are available.
- `next_cursor` (text): Cursor for next page.
- `status` (text): Action execution status.

**Example output**

```json
{
  "count": 1,
  "databases": [
    {
      "id": "x9y8z7w6v5u4",
      "name": "Tasks Database",
      "url": "https://www.notion.so/Tasks-Database-x9y8z7w6v5u4"
    }
  ],
  "has_more": false,
  "next_cursor": null,
  "status": "success"
}
```

### Retrieve page details

Look up a Notion page and get its title, link, and key details.

**Inputs**

- Page ID (`page_id`, text, required): Notion page ID.

**Outputs**

- `archived` (true/false): Whether page is archived.
- `id` (text): Notion page ID.
- `last_edited_time` (text): Last edit timestamp.
- `properties` (object): Extracted property values from the page.
- `status` (text): Action execution status.
- `title` (text): Page title.
- `url` (text): Page URL.

**Example output**

```json
{
  "archived": false,
  "id": "a1b2c3d4e5f6",
  "last_edited_time": "2024-01-15T10:30:00.000Z",
  "properties": {
    "Name": "Meeting Notes",
    "Status": "Complete"
  },
  "status": "success",
  "title": "Meeting Notes",
  "url": "https://www.notion.so/Meeting-Notes-a1b2c3d4e5f6"
}
```

### Search pages

Search for Notion pages that match the text you enter.

**Inputs**

- Query (`query`, text, required): What to search for.
- Number of results (`page_size`, number): Number of results to return.
- Start from (`start_cursor`, text): Leave blank for the first set of results. To get more, use the next cursor value from the previous run.

**Outputs**

- `count` (number): Number of pages returned.
- `has_more` (true/false): Whether more pages are available.
- `next_cursor` (text): Cursor for next page.
- `pages` (list): Array of Notion page objects.
- `status` (text): Action execution status.

**Example output**

```json
{
  "count": 1,
  "has_more": false,
  "next_cursor": null,
  "pages": [
    {
      "id": "a1b2c3d4e5f6",
      "last_edited_time": "2024-01-15T10:30:00.000Z",
      "title": "Project Planning",
      "url": "https://www.notion.so/Project-Planning-a1b2c3d4e5f6"
    }
  ],
  "status": "success"
}
```

### Update page properties

Update properties on an existing Notion page.

**Inputs**

- Page ID (`page_id`, text, required): Notion page ID.
- Properties (`properties`, object, required): The properties to change and their new values, in Notion's property format.

**Outputs**

- `id` (text): Updated page ID.
- `last_edited_time` (text): Last edit timestamp.
- `status` (text): Action execution status.
- `title` (text): Updated page title.
- `url` (text): Updated page URL.

**Example output**

```json
{
  "id": "a1b2c3d4e5f6",
  "last_edited_time": "2024-01-15T10:30:00.000Z",
  "status": "success",
  "title": "Updated Page",
  "url": "https://www.notion.so/Updated-Page-a1b2c3d4e5f6"
}
```
