Notion Core Workflow B — Blocks, Content & Comments
Overview
Secondary workflow for content operations: reading block trees, appending content, building rich text with annotations, and managing comments. SKILL.md keeps the flow at a high level; every full implementation lives in references/implementation.md.
Prerequisites
- Completed
notion-install-auth setup
- A Notion page shared with your integration
- Familiarity with
notion-core-workflow-a (databases/pages)
Authentication
All calls use the @notionhq/client SDK authenticated with an integration token read from process.env.NOTION_TOKEN. The token is provisioned by the notion-install-auth skill (internal integration secret) — do not hard-code it. The page or block being edited must be explicitly shared with that integration, or calls return object_not_found.
Instructions
The workflow has six steps. The client is created once and reused:
import { Client } from '@notionhq/client';
const notion = new Client({ auth: process.env.NOTION_TOKEN });
- Retrieve block children — page through
notion.blocks.children.list with a start_cursor loop (100 blocks/page) until has_more is false.
- Read blocks recursively — walk each block, and when
has_children is true recurse to build a nested tree; blockToText flattens a block's rich_text to a plain string.
- Append content blocks — one
notion.blocks.children.append call adds headings, formatted paragraphs, bulleted/numbered lists, to-dos, code, callouts, quotes, dividers, and toggles.
- Rich text annotations — each rich-text span carries
annotations (bold, italic, strikethrough, underline, code, color); spans can be plain text, links, user/page/date mentions, or LaTeX equations.
- Update and delete blocks —
notion.blocks.update replaces a block's content; notion.blocks.delete archives it.
- Work with comments —
notion.comments.create adds page or discussion-thread comments; notion.comments.list reads them back.
Each step's complete, copy-paste code is in references/implementation.md.
Output
- Page content blocks retrieved (flat or recursive tree)
- Rich content appended with formatting, lists, code, callouts
- Blocks updated and deleted
- Comments created and listed
Error Handling
| Error |
Cause |
Solution |
validation_error on append |
Invalid block type structure |
Check block type object shape |
object_not_found |
Block deleted or page not shared |
Verify block ID and permissions |
rate_limited (429) |
Rapid block operations |
Add delays between batch operations |
Empty rich_text array |
Block has no text content |
Check block type before accessing |
Examples
The building blocks above compose into full tasks. For instance, buildReport
assembles a heading, timestamp, divider, and a bulleted list, then appends them
in a single call:
async function buildReport(pageId: string, data: { title: string; items: string[] }) {
const blocks: any[] = [
{ heading_1: { rich_text: [{ text: { content: data.title } }] } },
{ paragraph: { rich_text: [{ text: { content: `Generated ${new Date().toISOString()}` } }] } },
{ divider: {} },
];
for (const item of data.items) {
blocks.push({ bulleted_list_item: { rich_text: [{ text: { content: item } }] } });
}
await notion.blocks.children.append({ block_id: pageId, children: blocks });
}
See references/examples.md for the annotated version and additional worked examples.
Resources
Source: jeremylongshore/claude-code-plugins-plus-skills → skills/.curated/notion-core-workflow-b/SKILL.md
Also appears in: jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/notion-pack/skills/notion-core-workflow-b/SKILL.md
1---2name: notion-core-workflow-b3description: | Work with Notion blocks, rich text, comments, and page content. Use when you need to read a page's block tree, append formatted content (headings, lists, callouts, code), edit or delete blocks, build rich text with annotations, or manage page and block comments through the Notion API. Trigger with phrases like "notion blocks", "notion page content", "notion rich text", "notion comments", "notion append blocks".4---56# Notion Core Workflow B — Blocks, Content & Comments78## Overview910Secondary workflow for content operations: reading block trees, appending content, building rich text with annotations, and managing comments. SKILL.md keeps the flow at a high level; every full implementation lives in [references/implementation.md](references/implementation.md).1112## Prerequisites1314- Completed `notion-install-auth` setup15- A Notion page shared with your integration16- Familiarity with `notion-core-workflow-a` (databases/pages)1718## Authentication1920All calls use the `@notionhq/client` SDK authenticated with an integration token read from `process.env.NOTION_TOKEN`. The token is provisioned by the `notion-install-auth` skill (internal integration secret) — do not hard-code it. The page or block being edited must be explicitly shared with that integration, or calls return `object_not_found`.2122## Instructions2324The workflow has six steps. The client is created once and reused:2526```typescript27import { Client } from '@notionhq/client';2829const notion = new Client({ auth: process.env.NOTION_TOKEN });30```31321. **Retrieve block children** — page through `notion.blocks.children.list` with a `start_cursor` loop (100 blocks/page) until `has_more` is false.332. **Read blocks recursively** — walk each block, and when `has_children` is true recurse to build a nested tree; `blockToText` flattens a block's `rich_text` to a plain string.343. **Append content blocks** — one `notion.blocks.children.append` call adds headings, formatted paragraphs, bulleted/numbered lists, to-dos, code, callouts, quotes, dividers, and toggles.354. **Rich text annotations** — each rich-text span carries `annotations` (`bold`, `italic`, `strikethrough`, `underline`, `code`, `color`); spans can be plain text, links, user/page/date mentions, or LaTeX equations.365. **Update and delete blocks** — `notion.blocks.update` replaces a block's content; `notion.blocks.delete` archives it.376. **Work with comments** — `notion.comments.create` adds page or discussion-thread comments; `notion.comments.list` reads them back.3839Each step's complete, copy-paste code is in [references/implementation.md](references/implementation.md).4041## Output4243- Page content blocks retrieved (flat or recursive tree)44- Rich content appended with formatting, lists, code, callouts45- Blocks updated and deleted46- Comments created and listed4748## Error Handling4950| Error | Cause | Solution |51| ------- | ------- | ---------- |52| `validation_error` on append | Invalid block type structure | Check block type object shape |53| `object_not_found` | Block deleted or page not shared | Verify block ID and permissions |54| `rate_limited` (429) | Rapid block operations | Add delays between batch operations |55| Empty `rich_text` array | Block has no text content | Check block type before accessing |5657## Examples5859The building blocks above compose into full tasks. For instance, `buildReport`60assembles a heading, timestamp, divider, and a bulleted list, then appends them61in a single call:6263```typescript64async function buildReport(pageId: string, data: { title: string; items: string[] }) {65 const blocks: any[] = [66 { heading_1: { rich_text: [{ text: { content: data.title } }] } },67 { paragraph: { rich_text: [{ text: { content: `Generated ${new Date().toISOString()}` } }] } },68 { divider: {} },69 ];70 for (const item of data.items) {71 blocks.push({ bulleted_list_item: { rich_text: [{ text: { content: item } }] } });72 }73 await notion.blocks.children.append({ block_id: pageId, children: blocks });74}75```7677See [references/examples.md](references/examples.md) for the annotated version and additional worked examples.7879## Resources8081- [Block Object Reference](https://developers.notion.com/reference/block)82- [Rich Text Reference](https://developers.notion.com/reference/rich-text)83- [Append Block Children](https://developers.notion.com/reference/patch-block-children)84- [Working with Page Content](https://developers.notion.com/docs/working-with-page-content)85- [Working with Comments](https://developers.notion.com/docs/working-with-comments)86- Full implementation: [references/implementation.md](references/implementation.md); worked examples: [references/examples.md](references/examples.md)87- For common errors, see the `notion-common-errors` skill.8889---9091**Source:** [`jeremylongshore/claude-code-plugins-plus-skills`](https://github.com/jeremylongshore/claude-code-plugins-plus-skills) → `skills/.curated/notion-core-workflow-b/SKILL.md`9293**Also appears in:** `jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/notion-pack/skills/notion-core-workflow-b/SKILL.md`