Pular para conteúdo

NOTION_CREATE_PAGE - Criar Página no Notion

O que é este Node?

O NOTION_CREATE_PAGE é o node responsável por criar novas páginas no Notion dentro de databases específicos, permitindo definir propriedades estruturadas e conteúdo inicial com blocks.

Por que este Node existe?

Criar páginas no Notion programaticamente permite automações poderosas. O NOTION_CREATE_PAGE existe para:

  1. Automação de documentação: Criar páginas automaticamente a partir de conversas no WhatsApp
  2. Knowledge base dinâmica: Adicionar artigos, FAQs e documentação em tempo real
  3. Project management: Criar tarefas, tickets e projetos sem acesso manual
  4. CRM no Notion: Registrar contatos, leads e interações automaticamente

Como funciona internamente?

Quando o NOTION_CREATE_PAGE é executado, o sistema:

  1. Autentica na Notion API: Usa o apiKey fornecido com header Notion-Version 2022-06-28
  2. Monta o payload: Combina parent (database), properties e content (blocks)
  3. Envia POST: Faz requisição para https://api.notion.com/v1/pages
  4. Recebe resposta: Notion retorna ID da página criada e URL pública
  5. Se erro: Retorna exceção com detalhes do erro da API
  6. Se sucesso: Retorna pageId e url para acesso direto

Código interno (productivity-executors.service.ts:373-388):

case 'createPage':
  const createPageResponse = await firstValueFrom(
    this.httpService.post(`${notionApiUrl}/pages`,
      {
        parent: { database_id: data.databaseId },
        properties: data.properties,
        children: data.content || [],
      },
      { headers }
    )
  );
  return {
    success: true,
    pageId: createPageResponse.data.id,
    url: createPageResponse.data.url,
  };

Quando você DEVE usar este Node?

Use NOTION_CREATE_PAGE sempre que precisar de criar páginas programaticamente no Notion:

Casos de uso

  1. Knowledge Base: "Criar artigo sobre {{topico}} no Notion"
  2. Task Management: "Registrar nova tarefa: {{descricao}}"
  3. CRM: "Adicionar lead {{nome}} com email {{email}} no database de clientes"
  4. Documentação automática: "Salvar esta conversa no Notion como página"
  5. Formulários: "Criar página de feedback com respostas do usuário"
  6. Content management: "Publicar novo post no blog Notion"

Quando NÃO usar NOTION_CREATE_PAGE

  • Atualizar página existente: Use NOTION_UPDATE_PAGE ao invés
  • Adicionar conteúdo a página existente: Use NOTION_ADD_BLOCK ao invés
  • Buscar páginas: Use NOTION_QUERY_DATABASE 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 com a integração!

Flow completo para testar:

{
  "name": "Teste Notion Create Page - 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": "Configurar Credentials",
        "parameters": {
          "assignments": [
            {
              "variable": "notion_api_key",
              "value": "secret_SEU_TOKEN_AQUI"
            },
            {
              "variable": "database_id",
              "value": "SEU_DATABASE_ID"
            }
          ]
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Criar Página",
        "parameters": {
          "operation": "createPage",
          "apiKey": "{{notion_api_key}}",
          "databaseId": "{{database_id}}",
          "properties": {
            "Name": {
              "title": [
                {
                  "text": {
                    "content": "Teste de Página"
                  }
                }
              ]
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Página criada! URL: {{notion_1.url}}"
        }
      }
    },
    {
      "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 SEU_TOKEN_AQUI e SEU_DATABASE_ID pelos valores reais.

databaseId (string, obrigatório)

O que é: ID do database do Notion onde a página será criada.

Como obter: 1. Abra o database no Notion 2. Copie a URL: https://notion.so/workspace/DATABASE_ID?v=... 3. O DATABASE_ID é o código entre / e ?v= 4. Exemplo: a8aec43c6f004f5789c9e2e4aa3e8d9f

Flow completo para testar:

{
  "name": "Teste Notion - Database 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": "Pedir Título",
        "parameters": {
          "message": "Qual o título da página?",
          "variable": "titulo_pagina"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Criar no Database",
        "parameters": {
          "operation": "createPage",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "a8aec43c6f004f5789c9e2e4aa3e8d9f",
          "properties": {
            "Name": {
              "title": [
                {
                  "text": {
                    "content": "{{titulo_pagina}}"
                  }
                }
              ]
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Página '{{titulo_pagina}}' criada com sucesso!"
        }
      }
    },
    {
      "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" }
  ]
}

Teste: Digite um título e veja a página ser criada no database.

properties (object, obrigatório)

O que é: Objeto contendo as propriedades do database (colunas) e seus valores.

Estrutura: Varia conforme o tipo de propriedade do database: - Title: { "title": [{ "text": { "content": "texto" } }] } - Rich Text: { "rich_text": [{ "text": { "content": "texto" } }] } - Number: { "number": 42 } - Select: { "select": { "name": "Opção" } } - Multi-select: { "multi_select": [{ "name": "Tag1" }, { "name": "Tag2" }] } - Date: { "date": { "start": "2025-01-15" } } - Checkbox: { "checkbox": true } - URL: { "url": "https://exemplo.com" } - Email: { "email": "email@exemplo.com" } - Phone: { "phone_number": "+5511999999999" }

Flow completo para testar:

{
  "name": "Teste Notion - Properties Completas",
  "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": "Nome do Cliente",
        "parameters": {
          "message": "Nome do cliente:",
          "variable": "nome_cliente"
        }
      }
    },
    {
      "id": "email_1",
      "type": "email",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Email",
        "parameters": {
          "message": "Email do cliente:",
          "variable": "email_cliente"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Criar Lead no Notion",
        "parameters": {
          "operation": "createPage",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "SEU_DATABASE_ID",
          "properties": {
            "Name": {
              "title": [
                {
                  "text": {
                    "content": "{{nome_cliente}}"
                  }
                }
              ]
            },
            "Email": {
              "email": "{{email_cliente}}"
            },
            "Status": {
              "select": {
                "name": "Novo Lead"
              }
            },
            "Data Contato": {
              "date": {
                "start": "{{current_date}}"
              }
            },
            "Origem": {
              "multi_select": [
                {
                  "name": "WhatsApp"
                },
                {
                  "name": "Automação"
                }
              ]
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Lead {{nome_cliente}} registrado no Notion!"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1100, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "input_1" },
    { "source": "input_1", "target": "email_1" },
    { "source": "email_1", "target": "notion_1" },
    { "source": "notion_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Os nomes das propriedades (Name, Email, Status) devem corresponder EXATAMENTE aos nomes das colunas no seu database Notion.

content (array, opcional)

O que é: Array de blocks (blocos de conteúdo) para adicionar à página ao criá-la.

Padrão: [] (página vazia)

Tipos de blocks disponíveis: - paragraph: Texto normal - heading_1: Título nível 1 - heading_2: Título nível 2 - heading_3: Título nível 3 - bulleted_list_item: Item de lista - numbered_list_item: Item numerado - to_do: Checkbox - code: Bloco de código - quote: Citação

Flow completo para testar:

{
  "name": "Teste Notion - Content com 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": "Criar Documentação",
        "parameters": {
          "operation": "createPage",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "SEU_DATABASE_ID",
          "properties": {
            "Name": {
              "title": [
                {
                  "text": {
                    "content": "Documentação de API"
                  }
                }
              ]
            }
          },
          "content": [
            {
              "object": "block",
              "type": "heading_1",
              "heading_1": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "Introdução"
                    }
                  }
                ]
              }
            },
            {
              "object": "block",
              "type": "paragraph",
              "paragraph": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "Esta é a documentação completa da nossa API."
                    }
                  }
                ]
              }
            },
            {
              "object": "block",
              "type": "heading_2",
              "heading_2": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "Endpoints"
                    }
                  }
                ]
              }
            },
            {
              "object": "block",
              "type": "bulleted_list_item",
              "bulleted_list_item": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "GET /api/users - Listar usuários"
                    }
                  }
                ]
              }
            },
            {
              "object": "block",
              "type": "bulleted_list_item",
              "bulleted_list_item": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "POST /api/users - Criar usuário"
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Documentação criada com conteúdo estruturado!"
        }
      }
    },
    {
      "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 a página criada com título, parágrafos e lista de bullets.

Parâmetros

Campo Tipo Obrigatório Descrição
operation string Sim Deve ser "createPage"
apiKey string Sim Token de integração do Notion
databaseId string Sim ID do database onde criar a página
properties object Sim Propriedades da página (colunas do database)
content array Não Blocks de conteúdo inicial (padrão: [])

Exemplo 1: Knowledge Base - Criar Artigo

Objetivo: Criar artigo de FAQ no Notion a partir de conversa

JSON para Importar

{
  "name": "Knowledge Base - Criar FAQ",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Introdução",
        "parameters": {
          "message": "Vou criar um artigo no Notion para você!"
        }
      }
    },
    {
      "id": "input_1",
      "type": "input",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Título",
        "parameters": {
          "message": "Qual o título do artigo?",
          "variable": "titulo"
        }
      }
    },
    {
      "id": "input_2",
      "type": "input",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Conteúdo",
        "parameters": {
          "message": "Qual o conteúdo?",
          "variable": "conteudo"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Criar Artigo",
        "parameters": {
          "operation": "createPage",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "SEU_DATABASE_ID",
          "properties": {
            "Título": {
              "title": [
                {
                  "text": {
                    "content": "{{titulo}}"
                  }
                }
              ]
            },
            "Categoria": {
              "select": {
                "name": "FAQ"
              }
            },
            "Status": {
              "select": {
                "name": "Publicado"
              }
            }
          },
          "content": [
            {
              "object": "block",
              "type": "paragraph",
              "paragraph": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "{{conteudo}}"
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    },
    {
      "id": "message_2",
      "type": "message",
      "position": { "x": 1100, "y": 100 },
      "data": {
        "label": "Sucesso",
        "parameters": {
          "message": "Artigo '{{titulo}}' publicado no Knowledge Base!"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1300, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "message_1" },
    { "source": "message_1", "target": "input_1" },
    { "source": "input_1", "target": "input_2" },
    { "source": "input_2", "target": "notion_1" },
    { "source": "notion_1", "target": "message_2" },
    { "source": "message_2", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: Vou criar um artigo no Notion para você!
Sistema: Qual o título do artigo?
Usuário: Como resetar minha senha?
Sistema: Qual o conteúdo?
Usuário: Acesse Configurações > Segurança > Resetar Senha
Sistema: Artigo 'Como resetar minha senha?' publicado no Knowledge Base!

Exemplo 2: CRM - Registrar Lead

Objetivo: Criar registro de lead no Notion CRM

JSON para Importar

{
  "name": "CRM - Registrar Lead",
  "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": "Nome",
        "parameters": {
          "message": "Qual seu nome?",
          "variable": "nome"
        }
      }
    },
    {
      "id": "email_1",
      "type": "email",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Email",
        "parameters": {
          "message": "Qual seu email?",
          "variable": "email"
        }
      }
    },
    {
      "id": "phone_1",
      "type": "phone",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Telefone",
        "parameters": {
          "message": "Qual seu telefone?",
          "variable": "telefone"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Criar Lead CRM",
        "parameters": {
          "operation": "createPage",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "SEU_DATABASE_CRM",
          "properties": {
            "Nome": {
              "title": [
                {
                  "text": {
                    "content": "{{nome}}"
                  }
                }
              ]
            },
            "Email": {
              "email": "{{email}}"
            },
            "Telefone": {
              "phone_number": "{{telefone}}"
            },
            "Status": {
              "select": {
                "name": "Novo Lead"
              }
            },
            "Origem": {
              "select": {
                "name": "WhatsApp"
              }
            },
            "Data": {
              "date": {
                "start": "{{current_date}}"
              }
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 1100, "y": 100 },
      "data": {
        "label": "Confirmação",
        "parameters": {
          "message": "Obrigado {{nome}}! Suas informações foram registradas. Em breve entraremos em contato."
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1300, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "input_1" },
    { "source": "input_1", "target": "email_1" },
    { "source": "email_1", "target": "phone_1" },
    { "source": "phone_1", "target": "notion_1" },
    { "source": "notion_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: Qual seu nome?
Usuário: João Silva
Sistema: Qual seu email?
Usuário: joao@exemplo.com
Sistema: Qual seu telefone?
Usuário: 11999999999
Sistema: Obrigado João Silva! Suas informações foram registradas. Em breve entraremos em contato.

Exemplo 3: Project Management - Criar Tarefa

Objetivo: Criar nova tarefa no Notion

JSON para Importar

{
  "name": "Project Management - Nova Tarefa",
  "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": "Tarefa",
        "parameters": {
          "message": "Qual tarefa deseja criar?",
          "variable": "tarefa"
        }
      }
    },
    {
      "id": "input_2",
      "type": "input",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Descrição",
        "parameters": {
          "message": "Descreva os detalhes:",
          "variable": "descricao"
        }
      }
    },
    {
      "id": "date_1",
      "type": "date",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Prazo",
        "parameters": {
          "message": "Qual o prazo? (YYYY-MM-DD)",
          "variable": "prazo"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Criar Tarefa",
        "parameters": {
          "operation": "createPage",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "SEU_DATABASE_TASKS",
          "properties": {
            "Tarefa": {
              "title": [
                {
                  "text": {
                    "content": "{{tarefa}}"
                  }
                }
              ]
            },
            "Status": {
              "select": {
                "name": "A Fazer"
              }
            },
            "Prioridade": {
              "select": {
                "name": "Média"
              }
            },
            "Prazo": {
              "date": {
                "start": "{{prazo}}"
              }
            }
          },
          "content": [
            {
              "object": "block",
              "type": "heading_2",
              "heading_2": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "Descrição"
                    }
                  }
                ]
              }
            },
            {
              "object": "block",
              "type": "paragraph",
              "paragraph": {
                "rich_text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "{{descricao}}"
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 1100, "y": 100 },
      "data": {
        "label": "Confirmação",
        "parameters": {
          "message": "Tarefa '{{tarefa}}' criada com prazo para {{prazo}}!"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1300, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "input_1" },
    { "source": "input_1", "target": "input_2" },
    { "source": "input_2", "target": "date_1" },
    { "source": "date_1", "target": "notion_1" },
    { "source": "notion_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: Qual tarefa deseja criar?
Usuário: Revisar documentação
Sistema: Descreva os detalhes:
Usuário: Revisar toda a documentação da API e corrigir erros
Sistema: Qual o prazo? (YYYY-MM-DD)
Usuário: 2025-01-20
Sistema: Tarefa 'Revisar documentação' criada com prazo para 2025-01-20!

Resposta do Node

{
  "success": true,
  "pageId": "a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f",
  "url": "https://www.notion.so/workspace/Nome-da-Pagina-a8aec43c6f004f5789c9e2e4aa3e8d9f"
}

Boas Práticas

SIM:

  • Sempre compartilhe o database com a integração antes de usar
  • Use variáveis para apiKey (não hardcode no flow)
  • Valide os nomes das propriedades (case-sensitive!)
  • Adicione conteúdo inicial com content para páginas mais completas
  • Use properties tipadas corretamente (title, select, date, etc.)

NÃO:

  • Não exponha o apiKey em logs ou mensagens
  • Não crie páginas sem validar os dados do usuário
  • Não use propriedades que não existem no database
  • Não esqueça de configurar as permissões da integração

Dicas

Configuração inicial: Crie a integração em notion.so/my-integrations e compartilhe o database Database ID: Copie da URL do database no Notion Properties: Nomes devem ser idênticos aos do database (case-sensitive) Content blocks: Use para criar páginas ricas com títulos, listas e parágrafos URL da página: Salve o retorno {{notion_1.url}} para enviar ao usuário Tipos de propriedades: Consulte a documentação oficial do Notion para tipos avançados

Próximo Node

NOTION_UPDATE_PAGE - Atualizar página existente → NOTION_QUERY_DATABASE - Buscar páginas no database → NOTION_ADD_BLOCK - Adicionar conteúdo a página existente