Pular para conteúdo

CALENDAR_GET_EVENT - Buscar Evento Específico do Google Calendar

O que é esta Tool?

A CALENDAR_GET_EVENT é a tool responsável por buscar detalhes completos de um evento específico usando seu ID único, retornando todas informações como título, data, participantes, local e status.

Por que esta Tool existe?

Consultar informações detalhadas de eventos é essencial. A CALENDAR_GET_EVENT existe para:

  1. Verificar Detalhes: Obter informações completas antes de atualizar ou excluir
  2. Validar Eventos: Confirmar se evento existe e está ativo
  3. Exibir Informações: Mostrar dados do evento para usuários
  4. Integração com Workflows: Tomar decisões baseadas em dados do evento

Como funciona internamente?

Quando a CALENDAR_GET_EVENT é executada, o sistema:

  1. Valida Autenticação: Verifica tokens OAuth2
  2. Busca Evento: GET /calendar/v3/calendars/{calendarId}/events/{eventId}
  3. Retorna Dados Completos: Título, descrição, datas, participantes, status
  4. Se não encontrado: Retorna erro 404
  5. Se sucesso: Objeto completo com todos os campos do evento

Código interno (google-executors.service.ts:403-413):

case 'getEvent':
  const getResult = await calendar.events.get({
    calendarId: data.calendarId || 'primary',
    eventId: data.eventId,
  });

  return {
    success: true,
    event: getResult.data,
  };

Quando você DEVE usar esta Tool?

Use CALENDAR_GET_EVENT sempre que precisar consultar evento específico:

Casos de uso

  1. Verificar Antes de Atualizar: "Buscar evento antes de reagendar"
  2. Exibir Detalhes: "Mostrar informações completas da reunião"
  3. Validar Existência: "Confirmar se evento ainda está ativo"
  4. Obter Participantes: "Listar quem está na reunião"

Quando NÃO usar CALENDAR_GET_EVENT

  • Buscar múltiplos eventos: Use CALENDAR_LIST_EVENTS
  • Pesquisar por termo: Use CALENDAR_SEARCH_EVENTS
  • Criar novo evento: Use CALENDAR_CREATE_EVENT

Parâmetros Detalhados

eventId (string, obrigatório)

O que é: ID único do evento a ser buscado.

Padrão: Nenhum (obrigatório)

Flow completo para testar:

{
  "name": "Buscar Detalhes de Evento",
  "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 do Evento",
        "parameters": {
          "message": "Digite o ID do evento:",
          "variableName": "eventId"
        }
      }
    },
    {
      "id": "calendar_1",
      "type": "google_calendar",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Buscar Evento",
        "operation": "getEvent",
        "oauth2": {
          "clientId": "{{GOOGLE_CLIENT_ID}}",
          "clientSecret": "{{GOOGLE_CLIENT_SECRET}}",
          "refreshToken": "{{GOOGLE_REFRESH_TOKEN}}"
        },
        "calendarId": "primary",
        "eventId": "{{eventId}}"
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Exibir Detalhes",
        "parameters": {
          "message": "Evento Encontrado:\n\nTítulo: {{calendar_1.event.summary}}\nInício: {{calendar_1.event.start.dateTime}}\nLocal: {{calendar_1.event.location}}\nStatus: {{calendar_1.event.status}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "input_1" },
    { "source": "input_1", "target": "calendar_1" },
    { "source": "calendar_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Digite um eventId válido e o sistema exibirá todos os detalhes do evento.

calendarId (string, opcional)

O que é: ID da agenda onde está o evento.

Padrão: "primary"

Parâmetros

Campo Tipo Obrigatório Descrição
eventId string Sim ID único do evento
calendarId string Não ID da agenda (padrão: primary)

Exemplo 1: Verificar Antes de Reagendar

Objetivo: Buscar evento, exibir dados e permitir reagendamento

JSON para Importar

{
  "name": "Verificar e Reagendar",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "calendar_get",
      "type": "google_calendar",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Buscar Evento",
        "operation": "getEvent",
        "oauth2": {
          "clientId": "{{GOOGLE_CLIENT_ID}}",
          "clientSecret": "{{GOOGLE_CLIENT_SECRET}}",
          "refreshToken": "{{GOOGLE_REFRESH_TOKEN}}"
        },
        "calendarId": "primary",
        "eventId": "abc123xyz"
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Exibir Evento Atual",
        "parameters": {
          "message": "Evento Atual:\n{{calendar_get.event.summary}}\n\nAgendado para: {{calendar_get.event.start.dateTime}}\n\nDeseja reagendar?"
        }
      }
    },
    {
      "id": "input_date",
      "type": "input",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Nova Data",
        "parameters": {
          "message": "Digite a nova data (YYYY-MM-DDTHH:MM:SS-03:00):",
          "variableName": "newStartDate"
        }
      }
    },
    {
      "id": "calendar_update",
      "type": "google_calendar",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Reagendar",
        "operation": "updateEvent",
        "oauth2": {
          "clientId": "{{GOOGLE_CLIENT_ID}}",
          "clientSecret": "{{GOOGLE_CLIENT_SECRET}}",
          "refreshToken": "{{GOOGLE_REFRESH_TOKEN}}"
        },
        "calendarId": "primary",
        "eventId": "abc123xyz",
        "startDateTime": "{{newStartDate}}"
      }
    },
    {
      "id": "message_2",
      "type": "message",
      "position": { "x": 1100, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "Evento reagendado com sucesso!"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1300, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "calendar_get" },
    { "source": "calendar_get", "target": "message_1" },
    { "source": "message_1", "target": "input_date" },
    { "source": "input_date", "target": "calendar_update" },
    { "source": "calendar_update", "target": "message_2" },
    { "source": "message_2", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: Evento Atual:
Reunião de Planejamento

Agendado para: 2025-10-15T14:00:00-03:00

Deseja reagendar?
Digite a nova data (YYYY-MM-DDTHH:MM:SS-03:00):
Usuário: 2025-10-20T10:00:00-03:00
Sistema: Evento reagendado com sucesso!

Resposta da Tool

{
  "success": true,
  "action": "calendar_get_event",
  "event": {
    "id": "abc123xyz789",
    "summary": "Reunião de Planejamento",
    "description": "Discussão sobre projeto Q4",
    "start": {
      "dateTime": "2025-10-15T14:00:00-03:00",
      "timeZone": "America/Sao_Paulo"
    },
    "end": {
      "dateTime": "2025-10-15T15:00:00-03:00",
      "timeZone": "America/Sao_Paulo"
    },
    "location": "Sala de Reuniões A",
    "status": "confirmed",
    "attendees": [
      {"email": "joao@empresa.com", "responseStatus": "accepted"},
      {"email": "maria@empresa.com", "responseStatus": "needsAction"}
    ],
    "htmlLink": "https://calendar.google.com/event?eid=abc123xyz789"
  },
  "timestamp": "2025-10-12T11:15:00.000Z"
}

Boas Práticas

SIM:

  • Use GET_EVENT antes de UPDATE ou DELETE para validar
  • Verifique status do evento (confirmed, tentative, cancelled)
  • Armazene dados em variáveis para uso posterior no flow
  • Trate erro 404 quando evento não existe

NÃO:

  • Não assuma que evento existe sem verificar
  • Não ignore responseStatus dos participantes
  • Não esqueça de verificar se evento foi cancelado (status: cancelled)

Dicas

Campos úteis retornados: id, summary, description, start, end, location, status, attendees, created, updated, htmlLink, hangoutLink.

Status possíveis: confirmed, tentative, cancelled.

Response Status dos participantes: needsAction, declined, tentative, accepted.

Próximos Nodes

CALENDAR_UPDATE_EVENT - Atualizar evento após consultar → CALENDAR_LIST_EVENTS - Listar múltiplos eventos → CALENDAR_DELETE_EVENT - Excluir após verificar