GET
https://api.myidvirtual.com
/
webhooks
/
tree
Gerenciamento de Árvore de Webhooks
curl --request GET \
  --url https://api.myidvirtual.com/webhooks/tree \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "status": "<string>"
}
'
{
  "userId": "user-id-123",
  "webhooks": [
    {
      "id": "webhook-id-1",
      "url": "https://servidor.com/webhook",
      "events": ["payment.created"]
    }
  ],
  "children": []
}

Gerenciamento de Árvore de Webhooks

Endpoints para gerenciar a estrutura hierárquica de webhooks vinculados a usuários.

Autenticação

Authorization
string
required
Bearer token JWT do usuário autenticado

Responses

{
  "userId": "user-id-123",
  "webhooks": [
    {
      "id": "webhook-id-1",
      "url": "https://servidor.com/webhook",
      "events": ["payment.created"]
    }
  ],
  "children": []
}

Adicionar Usuário à Árvore

Parâmetros

id
string
required
ID do webhook pai

Responses

{
  "success": true,
  "message": "Usuário adicionado à árvore de webhooks"
}

Alterar Status do Webhook

Request Body

status
string
required
Novo status: active, inactive, paused

Remover Usuário da Árvore

Responses

{
  "success": true,
  "message": "Usuário removido da árvore de webhooks"
}

Exemplo de Requisição

# Obter árvore
curl --location --request GET 'http://localhost:3333/webhooks/tree' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

# Adicionar à árvore
curl --location --request POST 'http://localhost:3333/webhooks/tree/webhook-id' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

# Alterar status
curl --location --request POST 'http://localhost:3333/webhooks/status/webhook-id' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{"status": "active"}'
Use a árvore de webhooks para propagar eventos em cascata pela hierarquia de usuários.