Pular para conteúdo

NOTION_GET_PAGE - Obter Página do Notion

O que é este Node?

O NOTION_GET_PAGE é o node responsável por recuperar informações completas de uma página específica do Notion usando seu ID, incluindo todas as propriedades e metadados.

Por que este Node existe?

Obter detalhes de uma página específica é essencial para workflows condicionais. O NOTION_GET_PAGE existe para:

  1. Leitura de dados: Recuperar informações específicas de uma página conhecida
  2. Validação: Verificar se página existe e está acessível
  3. Condições: Tomar decisões baseadas nas propriedades da página
  4. Integração: Buscar dados para usar em outros sistemas

Como funciona internamente?

Quando o NOTION_GET_PAGE é executado, o sistema:

  1. Autentica na Notion API: Usa o apiKey fornecido com header Notion-Version 2022-06-28
  2. Identifica a página: Usa o pageId fornecido
  3. Envia GET: Faz requisição para https://api.notion.com/v1/pages/{pageId}
  4. Processa resposta: Recebe objeto completo da página com todas as propriedades
  5. Se erro: Retorna exceção (página não encontrada, sem permissão, etc.)
  6. Se sucesso: Retorna objeto page completo

Código interno (baseado na Notion API v1):

case 'getPage':
  const getPageResponse = await firstValueFrom(
    this.httpService.get(`${notionApiUrl}/pages/${data.pageId}`, { headers })
  );
  return {
    success: true,
    page: getPageResponse.data,
    id: getPageResponse.data.id,
    properties: getPageResponse.data.properties,
  };

Quando você DEVE usar este Node?

Use NOTION_GET_PAGE sempre que precisar de obter detalhes de uma página específica por ID:

Casos de uso

  1. Verificar status: "Qual o status atual da tarefa X?"
  2. Ler propriedades: "Buscar email do lead na página"
  3. Validar existência: "Esta página ainda existe?"
  4. Decisões condicionais: "Se prioridade é Alta, fazer X"
  5. Sincronização: "Buscar última atualização da página"
  6. Auditoria: "Quando esta página foi criada?"

Quando NÃO usar NOTION_GET_PAGE

  • Buscar por filtro: Use NOTION_QUERY_DATABASE ao invés
  • Buscar múltiplas páginas: Use NOTION_QUERY_DATABASE ao invés
  • Buscar por nome/email: Use NOTION_QUERY_DATABASE com filtro ao invés
  • Listar todas as 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 a página com a integração!

Flow completo para testar:

{
  "name": "Teste Notion Get 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": "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": "Buscar Página",
        "parameters": {
          "operation": "getPage",
          "apiKey": "{{notion_api_key}}",
          "pageId": "{{page_id}}"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Mostrar Info",
        "parameters": {
          "message": "Página encontrada! ID: {{notion_1.id}}"
        }
      }
    },
    {
      "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 os dados da página.

pageId (string, obrigatório)

O que é: ID único da página do Notion a ser recuperada.

Como obter: 1. Abra a página no Notion 2. Copie a URL: https://notion.so/workspace/Nome-da-Pagina-PAGE_ID 3. O PAGE_ID é o código após o último traço 4. Exemplo: a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f 5. Ou salve o pageId quando criar a página com NOTION_CREATE_PAGE

Flow completo para testar:

{
  "name": "Teste Notion - Get Page by 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": "notion_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Obter Página",
        "parameters": {
          "operation": "getPage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{page_id}}"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Exibir Status",
        "parameters": {
          "message": "Status da página: {{notion_1.properties.Status.select.name}}"
        }
      }
    },
    {
      "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: Cole um pageId válido e veja o status da página.

Parâmetros

Campo Tipo Obrigatório Descrição
operation string Sim Deve ser "getPage"
apiKey string Sim Token de integração do Notion
pageId string Sim ID da página a obter

Exemplo 1: Verificar Status de Tarefa

Objetivo: Buscar status atual de uma tarefa e tomar decisão

JSON para Importar

{
  "name": "Verificar Status de 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": "Task ID",
        "parameters": {
          "message": "ID da tarefa:",
          "variable": "task_id"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Buscar Tarefa",
        "parameters": {
          "operation": "getPage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{task_id}}"
        }
      }
    },
    {
      "id": "condition_1",
      "type": "condition",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Está Concluída?",
        "parameters": {
          "condition": "{{notion_1.properties.Status.select.name}} == 'Concluído'"
        }
      }
    },
    {
      "id": "message_2",
      "type": "message",
      "position": { "x": 900, "y": 50 },
      "data": {
        "label": "Já Concluída",
        "parameters": {
          "message": "✅ Tarefa '{{notion_1.properties.Tarefa.title[0].text.content}}' já está concluída!"
        }
      }
    },
    {
      "id": "message_3",
      "type": "message",
      "position": { "x": 900, "y": 150 },
      "data": {
        "label": "Em Progresso",
        "parameters": {
          "message": "⏳ Tarefa '{{notion_1.properties.Tarefa.title[0].text.content}}' está em: {{notion_1.properties.Status.select.name}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1100, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "input_1" },
    { "source": "input_1", "target": "notion_1" },
    { "source": "notion_1", "target": "condition_1" },
    { "source": "condition_1", "target": "message_2", "label": "true" },
    { "source": "condition_1", "target": "message_3", "label": "false" },
    { "source": "message_2", "target": "end_1" },
    { "source": "message_3", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: ID da tarefa:
Usuário: a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f
Sistema: ⏳ Tarefa 'Revisar documentação' está em: Em Progresso

Exemplo 2: Ler Dados de Lead

Objetivo: Buscar informações completas de um lead

JSON para Importar

{
  "name": "Buscar Dados do 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": "Lead ID",
        "parameters": {
          "message": "ID do lead:",
          "variable": "lead_id"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Buscar Lead",
        "parameters": {
          "operation": "getPage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{lead_id}}"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Exibir Dados",
        "parameters": {
          "message": "📊 DADOS DO LEAD\n\nNome: {{notion_1.properties.Nome.title[0].text.content}}\nEmail: {{notion_1.properties.Email.email}}\nTelefone: {{notion_1.properties.Telefone.phone_number}}\nStatus: {{notion_1.properties.Status.select.name}}\nÚltima interação: {{notion_1.properties.Última Interação.date.start}}"
        }
      }
    },
    {
      "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: ID do lead:
Usuário: a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f
Sistema: 📊 DADOS DO LEAD

Nome: João Silva
Email: joao@exemplo.com
Telefone: +5511999999999
Status: Qualificado
Última interação: 2025-01-15

Resposta do Node

{
  "success": true,
  "page": {
    "object": "page",
    "id": "a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f",
    "created_time": "2025-01-15T10:00:00.000Z",
    "last_edited_time": "2025-01-15T10:30:00.000Z",
    "properties": {
      "Nome": {
        "title": [
          {
            "text": {
              "content": "Tarefa Exemplo"
            }
          }
        ]
      },
      "Status": {
        "select": {
          "name": "Em Progresso"
        }
      }
    },
    "url": "https://www.notion.so/..."
  },
  "id": "a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f",
  "properties": {
    "Nome": {
      "title": [
        {
          "text": {
            "content": "Tarefa Exemplo"
          }
        }
      ]
    }
  }
}

Boas Práticas

SIM:

  • Use quando você já tem o pageId específico
  • Combine com CONDITION para decisões baseadas em propriedades
  • Valide se a página foi encontrada antes de acessar propriedades
  • Use para auditar timestamps (created_time, last_edited_time)
  • Salve pageIds de NOTION_CREATE_PAGE para usar depois

NÃO:

  • Não use para buscar páginas por filtro (use QUERY ao invés)
  • Não acesse propriedades sem verificar se existem
  • Não faça múltiplas chamadas GET quando uma QUERY resolve
  • Não esqueça de tratar erro 404 (página não encontrada)

Dicas

Acessar propriedades: {{notion_1.properties.NomeDaPropriedade.tipo.campo}} Validar existência: Use CONDITION após GET para verificar se encontrou Timestamps: Use created_time e last_edited_time para auditoria URL da página: {{notion_1.page.url}} retorna link público Combinar com UPDATE: GET → CONDITION → UPDATE para workflows inteligentes Performance: GET é mais rápido que QUERY quando você tem o ID

Próximo Node

NOTION_QUERY_DATABASE - Buscar páginas com filtros → NOTION_UPDATE_PAGE - Atualizar página obtida → NOTION_SEARCH - Buscar páginas por texto