Pular para conteúdo

NOTION_UPDATE_PAGE - Atualizar Página no Notion

O que é este Node?

O NOTION_UPDATE_PAGE é o node responsável por atualizar propriedades de páginas existentes no Notion sem modificar seu conteúdo, permitindo mudanças de status, tags, datas e outros campos do database.

Por que este Node existe?

Atualizar páginas programaticamente é essencial para workflows automatizados. O NOTION_UPDATE_PAGE existe para:

  1. Mudança de status: Atualizar status de tarefas (A Fazer → Em Progresso → Concluído)
  2. Gestão de projetos: Modificar prioridades, prazos e responsáveis
  3. CRM automatizado: Atualizar estágio do lead, adicionar tags, registrar interações
  4. Workflow states: Mover páginas através de pipelines automaticamente

Como funciona internamente?

Quando o NOTION_UPDATE_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. Monta o payload: Cria objeto properties com campos a atualizar
  4. Envia PATCH: Faz requisição para https://api.notion.com/v1/pages/{pageId}
  5. Se erro: Retorna exceção (página não encontrada, permissão negada, etc.)
  6. Se sucesso: Retorna pageId confirmando atualização

Código interno (productivity-executors.service.ts:408-419):

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

Quando você DEVE usar este Node?

Use NOTION_UPDATE_PAGE sempre que precisar de modificar propriedades de páginas existentes:

Casos de uso

  1. Task management: "Marcar tarefa como concluída"
  2. Lead tracking: "Atualizar lead para 'Qualificado'"
  3. Status updates: "Mudar status do pedido para 'Enviado'"
  4. Adicionar tags: "Adicionar tag 'Urgente' à página"
  5. Atualizar datas: "Mudar prazo da tarefa para amanhã"
  6. Pipeline automation: "Mover card para próxima etapa"

Quando NÃO usar NOTION_UPDATE_PAGE

  • Adicionar conteúdo novo: Use NOTION_ADD_BLOCK ao invés
  • Criar página nova: Use NOTION_CREATE_PAGE ao invés
  • Modificar blocks existentes: 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 com a integração!

Flow completo para testar:

{
  "name": "Teste Notion Update - 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": "Atualizar Status",
        "parameters": {
          "operation": "updatePage",
          "apiKey": "{{notion_api_key}}",
          "pageId": "{{page_id}}",
          "properties": {
            "Status": {
              "select": {
                "name": "Concluído"
              }
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Página atualizada com sucesso!"
        }
      }
    },
    {
      "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 a página ser atualizada.

pageId (string, obrigatório)

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

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 - Page 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": "ID da Página",
        "parameters": {
          "message": "Cole o ID da página:",
          "variable": "page_id"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Atualizar Página",
        "parameters": {
          "operation": "updatePage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{page_id}}",
          "properties": {
            "Status": {
              "select": {
                "name": "Em Revisão"
              }
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Página atualizada para 'Em Revisão'!"
        }
      }
    },
    {
      "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 a propriedade Status ser atualizada.

properties (object, obrigatório)

O que é: Objeto contendo APENAS as propriedades que deseja atualizar. Propriedades não incluídas permanecem inalteradas.

Comportamento: PATCH parcial - só modifica os campos enviados.

Tipos de propriedades: - Title: { "title": [{ "text": { "content": "novo título" } }] } - Rich Text: { "rich_text": [{ "text": { "content": "texto" } }] } - Number: { "number": 100 } - Select: { "select": { "name": "Opção" } } - Multi-select: { "multi_select": [{ "name": "Tag1" }, { "name": "Tag2" }] } - Date: { "date": { "start": "2025-01-20" } } - Checkbox: { "checkbox": true } - URL: { "url": "https://novo-link.com" } - Email: { "email": "novo@email.com" } - Phone: { "phone_number": "+5511988888888" }

Flow completo para testar:

{
  "name": "Teste Notion - Update Properties",
  "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": "Intro",
        "parameters": {
          "message": "Vou atualizar o status da sua tarefa"
        }
      }
    },
    {
      "id": "notion_query_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Buscar Tarefa",
        "parameters": {
          "operation": "queryDatabase",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "SEU_DATABASE_ID",
          "filter": {
            "property": "Status",
            "select": {
              "equals": "A Fazer"
            }
          },
          "pageSize": 1
        }
      }
    },
    {
      "id": "notion_update_1",
      "type": "notion",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Atualizar para Em Progresso",
        "parameters": {
          "operation": "updatePage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{notion_query_1.results[0].id}}",
          "properties": {
            "Status": {
              "select": {
                "name": "Em Progresso"
              }
            },
            "Data Início": {
              "date": {
                "start": "{{current_date}}"
              }
            }
          }
        }
      }
    },
    {
      "id": "message_2",
      "type": "message",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Tarefa movida para 'Em Progresso'!"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1100, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "message_1" },
    { "source": "message_1", "target": "notion_query_1" },
    { "source": "notion_query_1", "target": "notion_update_1" },
    { "source": "notion_update_1", "target": "message_2" },
    { "source": "message_2", "target": "end_1" }
  ]
}

Teste: Busca primeira tarefa "A Fazer" e atualiza para "Em Progresso" com data de início.

Parâmetros

Campo Tipo Obrigatório Descrição
operation string Sim Deve ser "updatePage"
apiKey string Sim Token de integração do Notion
pageId string Sim ID da página a ser atualizada
properties object Sim Propriedades a atualizar (PATCH parcial)

Exemplo 1: Task Management - Marcar Concluída

Objetivo: Marcar tarefa como concluída quando usuário confirmar

JSON para Importar

{
  "name": "Task Management - Concluir 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": "ID da Tarefa",
        "parameters": {
          "message": "Digite o ID da tarefa concluída:",
          "variable": "task_id"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Marcar Concluída",
        "parameters": {
          "operation": "updatePage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{task_id}}",
          "properties": {
            "Status": {
              "select": {
                "name": "Concluído"
              }
            },
            "Concluída em": {
              "date": {
                "start": "{{current_date}}"
              }
            },
            "Progresso": {
              "number": 100
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Parabéns! Tarefa marcada como concluída."
        }
      }
    },
    {
      "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 o ID da tarefa concluída:
Usuário: a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f
Sistema: Parabéns! Tarefa marcada como concluída.

Exemplo 2: CRM - Atualizar Lead

Objetivo: Mover lead através do pipeline de vendas

JSON para Importar

{
  "name": "CRM - Qualificar 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": "Email do Lead",
        "parameters": {
          "message": "Qual o email do lead?",
          "variable": "email_lead"
        }
      }
    },
    {
      "id": "notion_query_1",
      "type": "notion",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Buscar Lead",
        "parameters": {
          "operation": "queryDatabase",
          "apiKey": "secret_SEU_TOKEN",
          "databaseId": "SEU_DATABASE_CRM",
          "filter": {
            "property": "Email",
            "email": {
              "equals": "{{email_lead}}"
            }
          }
        }
      }
    },
    {
      "id": "notion_update_1",
      "type": "notion",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Qualificar Lead",
        "parameters": {
          "operation": "updatePage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{notion_query_1.results[0].id}}",
          "properties": {
            "Status": {
              "select": {
                "name": "Qualificado"
              }
            },
            "Interesse": {
              "select": {
                "name": "Alto"
              }
            },
            "Última Interação": {
              "date": {
                "start": "{{current_date}}"
              }
            },
            "Tags": {
              "multi_select": [
                {
                  "name": "Contato Via WhatsApp"
                },
                {
                  "name": "Interesse Confirmado"
                }
              ]
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Lead qualificado e movido para próxima etapa!"
        }
      }
    },
    {
      "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_query_1" },
    { "source": "notion_query_1", "target": "notion_update_1" },
    { "source": "notion_update_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: Qual o email do lead?
Usuário: joao@exemplo.com
Sistema: Lead qualificado e movido para próxima etapa!

Exemplo 3: Adicionar Tags Dinamicamente

Objetivo: Adicionar tags a uma página baseado em interação

JSON para Importar

{
  "name": "Adicionar Tags à Página",
  "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": "ID da página:",
          "variable": "page_id"
        }
      }
    },
    {
      "id": "input_2",
      "type": "input",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Tags",
        "parameters": {
          "message": "Tags a adicionar (separadas por vírgula):",
          "variable": "tags_texto"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Adicionar Tags",
        "parameters": {
          "operation": "updatePage",
          "apiKey": "secret_SEU_TOKEN",
          "pageId": "{{page_id}}",
          "properties": {
            "Tags": {
              "multi_select": [
                {
                  "name": "Urgente"
                },
                {
                  "name": "Revisão Necessária"
                }
              ]
            }
          }
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Tags adicionadas com sucesso!"
        }
      }
    },
    {
      "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: ID da página:
Usuário: a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f
Sistema: Tags a adicionar (separadas por vírgula):
Usuário: Urgente, Revisão
Sistema: Tags adicionadas com sucesso!

Resposta do Node

{
  "success": true,
  "pageId": "a8aec43c-6f00-4f57-89c9-e2e4aa3e8d9f"
}

Boas Práticas

SIM:

  • Atualize apenas as propriedades necessárias (PATCH parcial)
  • Combine com NOTION_QUERY_DATABASE para buscar antes de atualizar
  • Salve o pageId ao criar páginas para facilitar atualizações futuras
  • Use variáveis para pageId vindos de queries anteriores
  • Valide se a página existe antes de tentar atualizar

NÃO:

  • Não tente atualizar o pageId (é imutável)
  • Não envie todas as propriedades se só precisa atualizar uma
  • Não use updatePage para adicionar conteúdo (use NOTION_ADD_BLOCK)
  • Não atualize páginas sem permissão da integração

Dicas

PATCH parcial: Envie apenas campos que deseja modificar, os outros permanecem intactos Combinar operações: Use QUERY + UPDATE para workflows completos Multi-select: Ao atualizar multi-select, você SUBSTITUI todas as tags (não adiciona) Integração com flows: Salve pageId de NOTION_CREATE_PAGE para usar em NOTION_UPDATE_PAGE depois Validação: Sempre verifique se pageId existe antes de atualizar Properties names: Nomes são case-sensitive e devem corresponder exatamente ao database

Próximo Node

NOTION_CREATE_PAGE - Criar nova página → NOTION_QUERY_DATABASE - Buscar páginas → NOTION_ADD_BLOCK - Adicionar conteúdo à página