Notion JSON outputs do not align with Select node inputs

I am using the Notion node to get all database items
I can see all the pages and their properties in the JSON data output from the Notion node.
The data is then input to the Select node. When trying to select some specific single select tags from the Notion output JSON, they are not available.

Page properties JSON output from Notion database get all

{

"object": "page",

"id": "88134091-470f-4ce4-95ed-859d1b368faa",

"created_time": "2021-07-28T03:59:00.000Z",

"last_edited_time": "2021-07-28T03:59:00.000Z",

"parent": {

"type": "database_id",

"database_id": "311a0ed6-466a-479d-8463-6f6b2336f87a"

},

"archived": false,

"properties": {

"Priority": {

"id": "GG|j",

"type": "select",

"select": {

"id": "8040baee-d544-42c1-9233-44c0d1c4731b",

"name": "normal",

"color": "purple"

}

},

"Created Time": {

"id": "GmNi",

"type": "created_time",

"created_time": "2021-07-28T03:59:00.000Z"

},

"State": {

"id": "Mlub",

"type": "select",

"select": {

"id": "59c9903e-4043-4a20-8f69-05c4ad257b3f",

"name": "To Do",

"color": "yellow"

}

},

"Shopping List": {

"id": "OEvm",

"type": "relation",

"relation": [

]

},

"Description": {

"id": "OYk~",

"type": "rich_text",

"rich_text": [

]

},

"Related People/Company": {

"id": "ShH=",

"type": "relation",

"relation": [

]

},

"Sub Tasks": {

"id": "Z:>]",

"type": "relation",

"relation": [

]

},

"Last Edited": {

"id": "\|?N",

"type": "last_edited_time",

"last_edited_time": "2021-07-28T03:59:00.000Z"

},

"Resources": {

"id": "^J_\",

"type": "relation",

"relation": [

]

},

"Dependent on (task)": {

"id": "^Xei",

"type": "relation",

"relation": [

]

},

"MS Todo ID": {

"id": "_;CB",

"type": "rich_text",

"rich_text": [

{

"type": "text",

"text": {

"content": "AQMkADAwATNiZmYAZC1kMjIANy1mM2VmLTAwAi0wMAoARgAAA6ppL6Vrf0xIl0Y_LfW97PIHAD4Z6lGx_BxMuHCzaZgxIKQAAAIBEgAAAD4Z6lGx_BxMuHCzaZgxIKQABGalJsIAAAA=",

"link": null

},

"annotations": {

"bold": false,

"italic": false,

"strikethrough": false,

"underline": false,

"code": false,

"color": "default"

},

"plain_text": "AQMkADAwATNiZmYAZC1kMjIANy1mM2VmLTAwAi0wMAoARgAAA6ppL6Vrf0xIl0Y_LfW97PIHAD4Z6lGx_BxMuHCzaZgxIKQAAAIBEgAAAD4Z6lGx_BxMuHCzaZgxIKQABGalJsIAAAA=",

"href": null

}

]

},

"DoDue": {

"id": "`AWd",

"type": "formula",

"formula": {

"type": "date",

"date": null

}

},

"Complete?": {

"id": "eGo;",

"type": "formula",

"formula": {

"type": "number",

"number": null

}

},

"Task Tags": {

"id": "qqIM",

"type": "multi_select",

"multi_select": [

]

},

"Related Project": {

"id": "vTBG",

"type": "relation",

"relation": [

]

},

"Name": {

"id": "title",

"type": "title",

"title": [

{

"type": "text",

"text": {

"content": "my notion task",

"link": null

},

"annotations": {

"bold": false,

"italic": false,

"strikethrough": false,

"underline": false,

"code": false,

"color": "default"

},

"plain_text": "my notion task",

"href": null

}

]

}

},

"url": "https://www.notion.so/123456"

},

screenshots of Select Node parameter selection

When trying to select some specific single select tags from the Notion output JSON, they are not available.

What do you mean with single select tags? what is the name of the property you want to select?

Priority and/or state

Does the first item of the databasePage:getAll output return priority and/or state? Because n8n uses the first item to create the values that you can select in the expression editor.

For clarification here is a screenshot of the Notion node I am using.

edited for clarification on which properties and screenshots I am pointing out.

The output of the notion node has an array of pages from the data base

Here is the top of the key value pairs returned in each page index of the JSON array. (not the entire list of properties)

The Properties key value pair is where the “state” and “priority” items will be.

In my first set of screenshots (from my first post) you can see all the properties available in the editor.

Looking through the raw JSON output of the notion database page node:
yes, priority and state are listed, but they are not in the editor.

That is weird. Can you share the workflow?

Anyways, you can still use the expression even though it’s not listed for some reason in the expression editor. Just do $node["Notion"].json["Priority"], that is assuming that node is named Notion.

This what you need?

 {

  "name": "On Notion page update, sync data to MS ToDo",

  "nodes": [

    {

      "parameters": {},

      "name": "Start",

      "type": "n8n-nodes-base.start",

      "typeVersion": 1,

      "position": [

        230,

        300

      ]

    },

    {

      "parameters": {

        "interval": "=1",

        "unit": "minutes"

      },

      "name": "Interval",

      "type": "n8n-nodes-base.interval",

      "typeVersion": 1,

      "position": [

        430,

        310

      ]

    },

    {

      "parameters": {

        "resource": "databasePage",

        "operation": "getAll",

        "databaseId": "311a0ed6-466a-479d-8463-6f6b2336f87a",

        "returnAll": true,

        "simple": false,

        "options": {}

      },

      "name": "Notion",

      "type": "n8n-nodes-base.notion",

      "typeVersion": 1,

      "position": [

        630,

        310

      ],

      "credentials": {

        "notionApi": "Notion API"

      }

    },

    {

      "parameters": {

        "functionCode": "const new_items = [];\n\n// Get static data stored with the workflow\nconst data = this.getWorkflowStaticData(\"node\");\n\ndata.ids = data.ids || [];\n\nfor (let i = items.length - 1; i >= 0; i--) {\n\n\t// Check if data is already present\n\tif (data.ids.includes(items[i].json.ID)) {\n\t\tbreak;\n\t} else {\n\n\t\t// if new data then add it to an array\n\t\tnew_items.push({\n\t\t\tjson: {\n\t\t\t\ttaskName: items[i].json.NotionTaskName,\n\t\t\t\tToDoID: items[i].json.NotionToDoID,\n\t\t\t\tProjectID: items[i].json.NotionProjectToDoID\n\t\t\t},\n\t\t});\n\t}\n}\n\ndata.ids = items.map((item) => item.json.taskName);\n\n// return new items\nreturn new_items;\n"

      },

      "name": "Function",

      "type": "n8n-nodes-base.function",

      "typeVersion": 1,

      "position": [

        1080,

        310

      ]

    },

    {

      "parameters": {

        "keepOnlySet": true,

        "values": {

          "string": [

            {

              "name": "NotionTaskName",

              "value": "={{$node[\"Notion\"].json[\"properties\"][\"Name\"][\"title\"][0][\"plain_text\"]}}"

            },

            {

              "name": "NotionToDoID",

              "value": "={{$node[\"Notion\"].json[\"properties\"][\"MS Todo ID\"][\"rich_text\"][0][\"plain_text\"]}}"

            },

            {

              "name": "notionTaskState",

              "value": "="

            },

            {

              "name": "NotionProjectToDoID",

              "value": "={{$node[\"Notion\"].json[\"properties\"][\"Related Project MS Todo List ID\"][\"rollup\"][\"array\"][0][\"text\"][0][\"plain_text\"]}}"

            }

          ]

        },

        "options": {}

      },

      "name": "Set",

      "type": "n8n-nodes-base.set",

      "typeVersion": 1,

      "position": [

        870,

        310

      ]

    }

  ],

  "connections": {

    "Interval": {

      "main": [

        [

          {

            "node": "Notion",

            "type": "main",

            "index": 0

          }

        ]

      ]

    },

    "Notion": {

      "main": [

        [

          {

            "node": "Set",

            "type": "main",

            "index": 0

          }

        ]

      ]

    },

    "Set": {

      "main": [

        [

          {

            "node": "Function",

            "type": "main",

            "index": 0

          }

        ]

      ]

    },

    "Function": {

      "main": [

        []

      ]

    }

  },

  "active": false,

  "settings": {},

  "id": 1

}

Also, I am trying to leverage the built-in functionality as much as possible before writing any JS.
Want to understand the caveats first.

I appreciate the work around, though.

So I tried the workaround you suggested @RicardoE105 and it was not able to find the property.
Then I tried to grab all the properties in the Select node, so I can see what I am able to see within the context of the Select node.

Using the following:
{{ $node["Notion"].json["properties"]}}

This is the output:

{
  "Created Time": {
    "id": "GmNi",
    "type": "created_time",
    "created_time": "2021-08-04T22:42:00.000Z"
  },
  "Project State": {
    "id": "G|\\R",
    "type": "rollup",
    "rollup": {
      "type": "array",
      "array": []
    }
  },
  "Related Project MS Todo List ID": {
    "id": "LW?b",
    "type": "rollup",
    "rollup": {
      "type": "array",
      "array": [
        {
          "type": "text",
          "text": [
            {
              "type": "text",
              "text": {
                "content": "AQMkADAwATNiZmYAZC1kMjIANy1mM2VmLTAwAi0wMAoALgAAA6ppL6Vrf0xIl0Y_LfW97PIBAD4Z6lGx_BxMuHCzaZgxIKQABI-aRdwAAAA=",
                "link": null
              },
              "annotations": {
                "bold": false,
                "italic": false,
                "strikethrough": false,
                "underline": false,
                "code": false,
                "color": "default"
              },
              "plain_text": "AQMkADAwATNiZmYAZC1kMjIANy1mM2VmLTAwAi0wMAoALgAAA6ppL6Vrf0xIl0Y_LfW97PIBAD4Z6lGx_BxMuHCzaZgxIKQABI-aRdwAAAA=",
              "href": null
            }
          ]
        }
      ]
    }
  },
  "Shopping List": {
    "id": "OEvm",
    "type": "relation",
    "relation": []
  },
  "Description": {
    "id": "OYk~",
    "type": "rich_text",
    "rich_text": []
  },
  "Related People/Company": {
    "id": "ShH=",
    "type": "relation",
    "relation": []
  },
  "Sub Tasks": {
    "id": "Z:>]",
    "type": "relation",
    "relation": []
  },
  "Last Edited": {
    "id": "\\|?N",
    "type": "last_edited_time",
    "last_edited_time": "2021-08-09T02:53:00.000Z"
  },
  "Resources": {
    "id": "^J_\\",
    "type": "relation",
    "relation": []
  },
  "Dependent on (task)": {
    "id": "^Xei",
    "type": "relation",
    "relation": []
  },
  "MS Todo ID": {
    "id": "_;CB",
    "type": "rich_text",
    "rich_text": [
      {
        "type": "text",
        "text": {
          "content": "AQMkADAwATNiZmYAZC1kMjIANy1mM2VmLTAwAi0wMAoARgAAA6ppL6Vrf0xIl0Y_LfW97PIHAD4Z6lGx_BxMuHCzaZgxIKQABI-aRdwAAAA_GepRsfgcTLhws2mYMSCkAASP2vMJAAAA",
          "link": null
        },
        "annotations": {
          "bold": false,
          "italic": false,
          "strikethrough": false,
          "underline": false,
          "code": false,
          "color": "default"
        },
        "plain_text": "AQMkADAwATNiZmYAZC1kMjIANy1mM2VmLTAwAi0wMAoARgAAA6ppL6Vrf0xIl0Y_LfW97PIHAD4Z6lGx_BxMuHCzaZgxIKQABI-aRdwAAAA_GepRsfgcTLhws2mYMSCkAASP2vMJAAAA",
        "href": null
      }
    ]
  },
  "DoDue": {
    "id": "`AWd",
    "type": "formula",
    "formula": {
      "type": "date",
      "date": null
    }
  },
  "Complete?": {
    "id": "eGo;",
    "type": "formula",
    "formula": {
      "type": "number",
      "number": null
    }
  },
  "Task Tags": {
    "id": "qqIM",
    "type": "multi_select",
    "multi_select": []
  },
  "Related Project": {
    "id": "vTBG",
    "type": "relation",
    "relation": [
      {
        "id": "a824cf5d-8830-4a09-991f-542e7e479767"
      }
    ]
  },
  "Name": {
    "id": "title",
    "type": "title",
    "title": [
      {
        "type": "text",
        "text": {
          "content": "Deposit claims check $2600",
          "link": null
        },
        "annotations": {
          "bold": false,
          "italic": false,
          "strikethrough": false,
          "underline": false,
          "code": false,
          "color": "default"
        },
        "plain_text": "Deposit claims check $2600",
        "href": null
      }
    ]
  }
}

The are many properties missing that are provided in the output of the Notion node.

That is weird. Is there any other node between the notion node and the node where you are referencing the notion node?

No.

I said ‘Select’ node earlier. I meant ‘Set’…
apologies.

Notion node grabs the data and the set node is where I can only see a limited sub set of the notion page properties.

Sent you a private message

The issue was that the first record did not have set all properties and n8n uses the properties of the first item to create the expression menu options.

1 Like

@RicardoE105 A similar issue is happening with me.
I cannot retrieve properties that have null values in the first item. So I created a workaround by placing zero in every cell in the database that did not have any values. Until today the notion node was retrieving the values as zero, but today the notion node for some reason today it started considering 0 = null.
Below are pictures of the notion node and my notion database.

Any ideas?

That is weird because we have not updated the notion node in a while. At least not something that would change that behavior. Anyways, Even if the field does not show up in the expression editor, you can still reference the values.

Hey @RicardoE105 !
Thanks for the quick answer.

I’m attaching below an image of an execution that happened a few days ago. It shows the zero values.

Also attaching an image of my postgresql node that I’m trying to query using the data from the Notion Node (this is on current execution, not the one a few days ago).
I’ve tried changing the parameters in red by copying the parameter path in the notion node JSON output, but it did not work.

In the meantime, I guess you can provide a default value when defining the expression. For example: {{$json["Usuarios"] || 0}}

Not all entries in these columns are 0 or empty. If I do that, I’ll change the data.

@RicardoE105 Did you get a chance to take a look at this?

I noticed something important.

All the other nodes in my workflow that come before Postgresql (which is the last node) receive all the parameters that come from the Notion node. It is only the Postgresql node that does not receive anything.

That actually doesn’t mean something didn’t change in the notion node (it clearly did because as per my previous images the exact same DB 3 weeks ago came with zeros and now is coming empty). It could also be a change in the notion API, maybe?