I’m working on updating Notion pages via n8n and need some guidance. My goal is to insert a new text block underneath a specific existing block on a Notion page. However, as we know, the Notion API currently only allows appending new blocks at the end of a parent’s children.
My proposed approach is as follows:
Retrieve the Full Page Content:
Get Block Children to fetch the entire JSON structure of the page.
Find the Target Block:
Find the block where I want to insert the new text
Modify the JSON:
Once the target is found, modify the JSON data to insert the new text block immediately after it. Essentially, this involves rebuilding the block array with the new block inserted at the desired index.
Clear and Rebuild the Notion Page:
Since there’s no native API method to remove all blocks at once, my idea is either to:
Archive/delete each block one by one via a PATCH (I am not sure it will work)
Re-Inject the Updated Blocks:
Finally, use the “Append Block Children” to recreate the updated page structure with the new block in its correct position.
I’d like to know:
Has anyone tried this approach successfully?
Are there better or more efficient alternative methods to manipulate the order of blocks on a Notion page using n8n?
Any insights, tips, or documented examples would be highly appreciated!
you can use the Block - Append After operation for that. You will need to get the page blocks to find the proper block ID and then use it to append a block after it.
Hi,
Thank you for the info
I am able to append a block to Heading when is a toggle
I can only append after but I am looking to Append right after the heading. (I am try to automate a release page so I need the new info on top of the previous one)
If I use the Append after and the {{parent_id}}. The text will be at the end of the page
If I use the Append after and the {{id}} of the heading, the text will be at the end of the Toggle
That will not work for my use case because I connected the page to a Zendesk support page so the page needs to stay the same
I think my situation is not a usual use case for Notion API
Thank you for your help !!
Well… you can try an update page method to rewrite the content, but you will need an HTTP node with creds from the notion, as the notion node doesn’t have that method. I can’t advice how the request will be, as the docs are not very clear about the properties section
I found the answer using the documentation !
We can the use the Http Requestion :
PATCH https://api.notion.com/v1/blocks/{{ $json.parent_id }}/children