I figured I might as well add my post to the ever-growing list of unsolved posts about this
I need to replicate this code in Make
const blockContents = blocks
.filter((block) => block.type !== "file")
.map((block) => {
return {
type: block.type,
[block.type]: {
...block[block.type],
},
};
});
So essentially, extracting
{
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Some text",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "orange_background"
},
"plain_text": "Some text",
"href": null
}
],
"color": "default"
}
}
from objects like this
{
"object": "block",
"id": "2e086381-b461-4860-8ab5-9279c992f78d",
"parent": {
"type": "page_id",
"page_id": "ba4aca1a-4a13-4e23-adc0-0f8d7d767b94"
},
"created_time": "2024-01-09T13:53:00.000Z",
"last_edited_time": "2024-01-09T14:17:00.000Z",
"created_by": {
"object": "user",
"id": "76c0e327-b5c1-4c38-b0e9-73afdbbff391"
},
"last_edited_by": {
"object": "user",
"id": "76c0e327-b5c1-4c38-b0e9-73afdbbff391"
},
"has_children": false,
"archived": false,
"in_trash": false,
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Some text",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "orange_background"
},
"plain_text": "Some text",
"href": null
}
],
"color": "default"
}
}
I do need the entire collection because I’m copying these blocks (without their IDs), from one Notion page to another. So I need to insert the collection in another API request.
But Make gives me
{
"type": "heading_3",
"heading_3": "[Collection]"
}
here