NOTION_ADD_BLOCK - Adicionar Conteúdo a Página no Notion
O que é este Node?
O NOTION_ADD_BLOCK é o node responsável por adicionar blocos de conteúdo a páginas existentes no Notion, permitindo anexar parágrafos, títulos, listas, código e outros elementos a uma página já criada.
Por que este Node existe?
Adicionar conteúdo programaticamente a páginas existentes é essencial para documentação dinâmica. O NOTION_ADD_BLOCK existe para:
- Documentação progressiva: Adicionar seções a artigos conforme conversas acontecem
- Logs e histórico: Registrar interações e eventos em páginas de registro
- Colaboração automática: Anexar notas, comentários e atualizações
- Content building: Construir páginas complexas passo a passo
Como funciona internamente?
Quando o NOTION_ADD_BLOCK é executado, o sistema:
- Autentica na Notion API: Usa o apiKey fornecido com header Notion-Version 2022-06-28
- Identifica o block pai: Usa o blockId (que pode ser um pageId)
- Monta array de blocks: Prepara os blocos a serem adicionados
- Envia PATCH: Faz requisição para
https://api.notion.com/v1/blocks/{blockId}/children - Se erro: Retorna exceção (block não encontrado, estrutura inválida, etc.)
- Se sucesso: Retorna results com os blocks criados
Código interno (productivity-executors.service.ts:421-433):
case 'appendBlock':
const appendBlockResponse = await firstValueFrom(
this.httpService.patch(`${notionApiUrl}/blocks/${data.blockId}/children`,
{
children: data.blocks,
},
{ headers }
)
);
return {
success: true,
results: appendBlockResponse.data.results,
};
Quando você DEVE usar este Node?
Use NOTION_ADD_BLOCK sempre que precisar de adicionar conteúdo a páginas existentes:
Casos de uso
- Logs de conversa: "Adicionar esta interação à página de histórico"
- Documentação incremental: "Adicionar nova seção FAQ ao artigo"
- Notas de reunião: "Anexar pontos discutidos à ata"
- Registro de eventos: "Adicionar log de erro à página de troubleshooting"
- Building content: "Construir relatório adicionando seções progressivamente"
- Comments/Updates: "Adicionar atualização ao projeto"
Quando NÃO usar NOTION_ADD_BLOCK
- Criar página nova: Use NOTION_CREATE_PAGE ao invés
- Atualizar propriedades: Use NOTION_UPDATE_PAGE ao invés
- Modificar block existente: Use NOTION_UPDATE_BLOCK ao invés
Parâmetros Detalhados
apiKey (string, obrigatório)
O que é: Token de integração do Notion (obtido em notion.so/my-integrations).
Como obter: 1. Acesse https://www.notion.so/my-integrations 2. Clique em "New integration" 3. Dê um nome e selecione workspace 4. Copie o "Internal Integration Token" 5. IMPORTANTE: Compartilhe o database/página com a integração!
Flow completo para testar:
{
"name": "Teste Notion Add Block - API Key",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Config",
"parameters": {
"assignments": [
{
"variable": "notion_api_key",
"value": "secret_SEU_TOKEN_AQUI"
},
{
"variable": "page_id",
"value": "a8aec43c6f004f5789c9e2e4aa3e8d9f"
}
]
}
}
},
{
"id": "notion_1",
"type": "notion",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Adicionar Parágrafo",
"parameters": {
"operation": "appendBlock",
"apiKey": "{{notion_api_key}}",
"blockId": "{{page_id}}",
"blocks": [
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Conteúdo adicionado automaticamente!"
}
}
]
}
}
]
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Conteúdo adicionado à página!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "notion_1" },
{ "source": "notion_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Substitua pelos valores reais e veja o parágrafo ser adicionado.
blockId (string, obrigatório)
O que é: ID do block (ou página) onde o conteúdo será adicionado. No caso de páginas, use o pageId.
Como obter:
1. Para páginas: Use o pageId (copie da URL ou salve de NOTION_CREATE_PAGE)
2. Para blocks: Use o blockId de um block existente
3. Formato: a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f
Observação: Na maioria dos casos, você usará um pageId para adicionar conteúdo ao final da página.
Flow completo para testar:
{
"name": "Teste Notion - Block ID",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "input_1",
"type": "input",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Page ID",
"parameters": {
"message": "Cole o ID da página:",
"variable": "page_id"
}
}
},
{
"id": "input_2",
"type": "input",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Conteúdo",
"parameters": {
"message": "O que deseja adicionar?",
"variable": "conteudo"
}
}
},
{
"id": "notion_1",
"type": "notion",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Adicionar",
"parameters": {
"operation": "appendBlock",
"apiKey": "secret_SEU_TOKEN",
"blockId": "{{page_id}}",
"blocks": [
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "{{conteudo}}"
}
}
]
}
}
]
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Conteúdo '{{conteudo}}' adicionado!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1100, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "input_1" },
{ "source": "input_1", "target": "input_2" },
{ "source": "input_2", "target": "notion_1" },
{ "source": "notion_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Cole um pageId e digite texto para adicionar.
blocks (array, obrigatório)
O que é: Array de blocks (blocos de conteúdo) a serem adicionados à página.
Tipos de blocks disponíveis:
Paragraph (Parágrafo):
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Texto do parágrafo"
}
}
]
}
}
Heading 1:
{
"object": "block",
"type": "heading_1",
"heading_1": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Título Principal"
}
}
]
}
}
Heading 2:
{
"object": "block",
"type": "heading_2",
"heading_2": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Subtítulo"
}
}
]
}
}
Bulleted List:
{
"object": "block",
"type": "bulleted_list_item",
"bulleted_list_item": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Item da lista"
}
}
]
}
}
Numbered List:
{
"object": "block",
"type": "numbered_list_item",
"numbered_list_item": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Item numerado"
}
}
]
}
}
To-Do (Checkbox):
{
"object": "block",
"type": "to_do",
"to_do": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Tarefa a fazer"
}
}
],
"checked": false
}
}
Quote (Citação):
{
"object": "block",
"type": "quote",
"quote": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Citação importante"
}
}
]
}
}
Code Block:
{
"object": "block",
"type": "code",
"code": {
"rich_text": [
{
"type": "text",
"text": {
"content": "const x = 10;"
}
}
],
"language": "javascript"
}
}
Flow completo para testar:
{
"name": "Teste Notion - Múltiplos Blocks",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "notion_1",
"type": "notion",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Adicionar Seção Completa",
"parameters": {
"operation": "appendBlock",
"apiKey": "secret_SEU_TOKEN",
"blockId": "SEU_PAGE_ID",
"blocks": [
{
"object": "block",
"type": "heading_2",
"heading_2": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Nova Seção Adicionada"
}
}
]
}
},
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Esta seção foi adicionada automaticamente via API."
}
}
]
}
},
{
"object": "block",
"type": "bulleted_list_item",
"bulleted_list_item": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Primeiro ponto"
}
}
]
}
},
{
"object": "block",
"type": "bulleted_list_item",
"bulleted_list_item": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Segundo ponto"
}
}
]
}
},
{
"object": "block",
"type": "to_do",
"to_do": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Revisar este conteúdo"
}
}
],
"checked": false
}
}
]
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Seção completa adicionada à página!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "notion_1" },
{ "source": "notion_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Veja uma seção completa com título, parágrafo, lista e to-do ser adicionada.
Parâmetros
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| operation | string | Sim | Deve ser "appendBlock" |
| apiKey | string | Sim | Token de integração do Notion |
| blockId | string | Sim | ID do block/página onde adicionar conteúdo |
| blocks | array | Sim | Array de blocks a adicionar |
Exemplo 1: Log de Conversa
Objetivo: Adicionar registro de interação em página de histórico
JSON para Importar
{
"name": "Log de Conversa no Notion",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "input_1",
"type": "input",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Mensagem do Usuário",
"parameters": {
"message": "Digite sua mensagem:",
"variable": "user_message"
}
}
},
{
"id": "notion_1",
"type": "notion",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Registrar Interação",
"parameters": {
"operation": "appendBlock",
"apiKey": "secret_SEU_TOKEN",
"blockId": "PAGE_ID_DO_LOG",
"blocks": [
{
"object": "block",
"type": "heading_3",
"heading_3": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Interação - {{current_date}} {{current_time}}"
}
}
]
}
},
{
"object": "block",
"type": "quote",
"quote": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Usuário: {{user_message}}"
}
}
]
}
},
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Canal: WhatsApp | Status: Registrado"
}
}
]
}
}
]
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Interação registrada no histórico!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "input_1" },
{ "source": "input_1", "target": "notion_1" },
{ "source": "notion_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Saída esperada:
Sistema: Digite sua mensagem:
Usuário: Preciso de ajuda com a integração
Sistema: Interação registrada no histórico!
Exemplo 2: Documentação Incremental - FAQ
Objetivo: Adicionar nova pergunta/resposta a FAQ existente
JSON para Importar
{
"name": "Adicionar FAQ ao Notion",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "input_1",
"type": "input",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Pergunta",
"parameters": {
"message": "Qual a pergunta frequente?",
"variable": "pergunta"
}
}
},
{
"id": "input_2",
"type": "input",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Resposta",
"parameters": {
"message": "Qual a resposta?",
"variable": "resposta"
}
}
},
{
"id": "notion_1",
"type": "notion",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Adicionar FAQ",
"parameters": {
"operation": "appendBlock",
"apiKey": "secret_SEU_TOKEN",
"blockId": "PAGE_ID_FAQ",
"blocks": [
{
"object": "block",
"type": "heading_3",
"heading_3": {
"rich_text": [
{
"type": "text",
"text": {
"content": "{{pergunta}}"
}
}
]
}
},
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "{{resposta}}"
}
}
]
}
}
]
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "FAQ atualizada com nova pergunta!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1100, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "input_1" },
{ "source": "input_1", "target": "input_2" },
{ "source": "input_2", "target": "notion_1" },
{ "source": "notion_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Saída esperada:
Sistema: Qual a pergunta frequente?
Usuário: Como resetar minha senha?
Sistema: Qual a resposta?
Usuário: Clique em "Esqueci minha senha" na tela de login
Sistema: FAQ atualizada com nova pergunta!
Resposta do Node
{
"success": true,
"results": [
{
"id": "block-id-1",
"type": "heading_2",
"created_time": "2025-01-15T10:30:00.000Z"
},
{
"id": "block-id-2",
"type": "paragraph",
"created_time": "2025-01-15T10:30:00.000Z"
}
]
}
Boas Práticas
SIM:
- Adicione múltiplos blocks de uma vez para criar seções completas
- Use heading para organizar o conteúdo adicionado
- Combine com NOTION_QUERY para buscar a página antes de adicionar
- Use variáveis do flow para conteúdo dinâmico
- Adicione timestamps para logs e históricos
NÃO:
- Não adicione blocks sem estrutura (sempre use object e type corretos)
- Não esqueça rich_text mesmo para textos simples
- Não tente modificar blocks existentes (use UPDATE ao invés)
- Não adicione conteúdo sensível sem validação
Dicas
Múltiplos blocks: Adicione vários de uma vez para criar seções estruturadas Rich text obrigatório: Mesmo texto simples precisa do formato rich_text Page = Block: PageId pode ser usado como blockId Ordem importa: Blocks são adicionados na ordem do array Code blocks: Especifique language para syntax highlighting To-do: Use para criar checklists dinâmicas
Próximo Node
→ NOTION_CREATE_PAGE - Criar nova página → NOTION_UPDATE_PAGE - Atualizar propriedades → NOTION_UPDATE_BLOCK - Modificar block existente