Notion append block bug

Hello,

I wanna make new notion page and after that loop over array each time append block, according to N8N instead of block id can be used page idimage

{
  "nodes": [
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": "51041012-9664-43f8-8237-b91d26f87ea9",
        "simple": false,
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Name|title",
              "title": "test"
            }
          ]
        },
        "blockUi": {
          "blockValues": []
        }
      },
      "name": "Notion",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {
        "notionApi": "[email protected]"
      }
    },
    {
      "parameters": {
        "functionCode": "return [{\n    json: {\n      \"message\": 1\n    }\n  },\n  {\n    json: {\n      \"message\": 11\n    }\n  },\n  {\n    json: {\n      \"message\": 12\n    }\n  },\n  {\n    json: {\n      \"message\": 13\n    }\n  }\n];"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        640,
        300
      ]
    },
    {
      "parameters": {
        "resource": "block",
        "blockId": "={{$node[\"Notion\"].parameter[\"databaseId\"]}}",
        "blockUi": {
          "blockValues": [
            {
              "textContent": "={{$json[\"message\"]}}"
            }
          ]
        }
      },
      "name": "Notion2",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 1,
      "position": [
        840,
        300
      ],
      "credentials": {
        "notionApi": "[email protected]"
      }
    }
  ],
  "connections": {
    "Notion": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Notion2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  } 
}

This return empty 400 error, according to notion API docs this can mean wrong block id or Rate limits

  • wrong block id - I could not find confirmation that page id is okay instead of block id, but also I do not see way how to get block id from page id
  • rate limit - probably not because they say “3 requests per second” what I not extend also I copied some block id, and it worked

What I do not understand is that at the very 1 try it worked but only once, and I could not reproduce it

Anyone maybe knows how to deal with that?
Thank you in advance!

It only works with the first item because the second notion node (append:block) receives 4 items as input and the first notion node (databasePage:create) returns only one item. In order words, after the first iteration, the expression {{$node["Notion"].parameter["databaseId"]}} resolves to undefined. To fix the issue, set the block_id parameter with the expression: {{ $item(0).$node["Notion"].json["id"] }} instead. You can also check the example workflow below:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": "c7f1bbde-9254-49dc-8fd5-646c4ad731aa",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Name|title",
              "title": "ricardopapa"
            }
          ]
        }
      },
      "name": "Notion",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 1,
      "position": [
        540,
        300
      ],
      "credentials": {
        "notionApi": {
          "id": "328",
          "name": "misma 2"
        }
      }
    },
    {
      "parameters": {
        "resource": "block",
        "blockId": "={{ $item(0).$node[\"Notion\"].json[\"id\"] }}",
        "blockUi": {
          "blockValues": [
            {
              "textContent": "={{$json[\"message\"]}}"
            }
          ]
        }
      },
      "name": "Notion2",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "credentials": {
        "notionApi": {
          "id": "328",
          "name": "misma 2"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      message: \"message1\"\n    }\n  },\n    {\n    json: {\n      message: \"message2\"\n    }\n  }\n]"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        800,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Notion2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}