> ## Documentation Index
> Fetch the complete documentation index at: https://gowa-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Gestión de grupos

> Crea grupos, administra participantes y administradores, gestiona solicitudes de inscripción, cambia la configuración y envía a grupos.

Todas las rutas de grupo son de dispositivo: enviar `X-Device-Id`. Los IDs de grupo son JIDs que terminan en `@g.us`, como `120363025246125486@g.us`. Las acciones de administración necesitan que la cuenta sea un administrador de grupo.

```bash theme={null}
export GOWA=http://localhost:3000 AUTH=admin:changeme DEVICE=my-device
```

## Crear e inspeccionar

```bash theme={null}
# create (participants: numbers or JIDs)
curl -u $AUTH -X POST $GOWA/group -H "X-Device-Id: $DEVICE" \
  -H "Content-Type: application/json" \
  -d '{"title": "Project Team", "participants": ["628111111111", "628222222222"]}'

# info and participants
curl -u $AUTH -H "X-Device-Id: $DEVICE" "$GOWA/group/info?group_id=120363025246125486@g.us"
curl -u $AUTH -H "X-Device-Id: $DEVICE" "$GOWA/group/participants?group_id=120363025246125486@g.us"

# participants as CSV
curl -u $AUTH -H "X-Device-Id: $DEVICE" "$GOWA/group/participants/export?group_id=120363025246125486@g.us" -o members.csv

# groups this account is in
curl -u $AUTH -H "X-Device-Id: $DEVICE" $GOWA/user/my/groups
```

## Participantes

El mismo cuerpo trabaja para añadir, eliminar, promover y degradar:

```bash theme={null}
BODY='{"group_id": "120363025246125486@g.us", "participants": ["628333333333"]}'

curl -u $AUTH -X POST $GOWA/group/participants          -H "X-Device-Id: $DEVICE" -H "Content-Type: application/json" -d "$BODY"  # add
curl -u $AUTH -X POST $GOWA/group/participants/remove   -H "X-Device-Id: $DEVICE" -H "Content-Type: application/json" -d "$BODY"
curl -u $AUTH -X POST $GOWA/group/participants/promote  -H "X-Device-Id: $DEVICE" -H "Content-Type: application/json" -d "$BODY"
curl -u $AUTH -X POST $GOWA/group/participants/demote   -H "X-Device-Id: $DEVICE" -H "Content-Type: application/json" -d "$BODY"
```

WhatsApp puede negarse a añadir a alguien directamente debido a su configuración de privacidad. Envíale el enlace de invitación en su lugar.

## Peticiones de unión

Para grupos que requieren la aprobación del administrador:

```bash theme={null}
curl -u $AUTH -H "X-Device-Id: $DEVICE" \
  "$GOWA/group/participant-requests?group_id=120363025246125486@g.us"

curl -u $AUTH -X POST $GOWA/group/participant-requests/approve \
  -H "X-Device-Id: $DEVICE" -H "Content-Type: application/json" \
  -d '{"group_id": "120363025246125486@g.us", "participants": ["628444444444"]}'
# reject: /group/participant-requests/reject with the same body
```

## Ajustes

| Ajustes | Endpoint | Cuerpo |
| - | - | - |
| Nombre | `POST /group/name` | `{"group_id": "...", "name": "New name"}` |
| Descripción | `POST /group/topic` | `{"group_id": "...", "topic": "About this group"}` (vacío lo elimina) |
| Foto | `POST /group/photo` | multipart: `group_id`, `photo` (omite `photo` para eliminar la foto) |
| Solo los administradores editar información | `POST /group/locked` | `{"group_id": "...", "locked": true}` |
| Solo los administradores enviados | `POST /group/announce` | `{"group_id": "...", "announce": true}` |

```bash theme={null}
curl -u $AUTH -X POST $GOWA/group/announce -H "X-Device-Id: $DEVICE" \
  -H "Content-Type: application/json" \
  -d '{"group_id": "120363025246125486@g.us", "announce": true}'
```

## Enlaces de invitación

```bash theme={null}
# get the link (reset=true revokes the old one and creates a new one)
curl -u $AUTH -H "X-Device-Id: $DEVICE" \
  "$GOWA/group/invite-link?group_id=120363025246125486@g.us&reset=false"

# preview a group from a link without joining
curl -u $AUTH -H "X-Device-Id: $DEVICE" \
  "$GOWA/group/info-from-link?link=https://chat.whatsapp.com/AbCdEfGhIjKl"

# join
curl -u $AUTH -X POST $GOWA/group/join-with-link -H "X-Device-Id: $DEVICE" \
  -H "Content-Type: application/json" -d '{"link": "https://chat.whatsapp.com/AbCdEfGhIjKl"}'

# leave
curl -u $AUTH -X POST $GOWA/group/leave -H "X-Device-Id: $DEVICE" \
  -H "Content-Type: application/json" -d '{"group_id": "120363025246125486@g.us"}'
```

## Mensajes de un grupo

Usa el JID del grupo como `phone` en cualquier endpoint `/send/*`. Menciona a los miembros con `mentions`, o a todos con `"@everyone"`:

```bash theme={null}
curl -u $AUTH -X POST $GOWA/send/message -H "X-Device-Id: $DEVICE" \
  -H "Content-Type: application/json" \
  -d '{"phone": "120363025246125486@g.us", "message": "Standup in 5 minutes", "mentions": ["@everyone"]}'
```

## Eventos de grupo

Suscríbete a los webhook `group.participants` (unirse, dejar, promocionar, demotar) y `group.joined` (fuiste añadido). Ejemplo de Payloade:

```json theme={null}
{
  "event": "group.participants",
  "device_id": "628123456789@s.whatsapp.net",
  "payload": {"chat_id": "120363025246125486@g.us", "type": "join", "jids": ["628333333333@s.whatsapp.net"]}
}
```


## Related topics

- [Grupos de Lista de Usuarios](https://gowa-docs.mintlify.site/es/api-reference/user/grupos-de-lista-de-usuarios.md)
- [Enlace de invitación de grupo](https://gowa-docs.mintlify.site/es/api-reference/group/enlace-de-invitación-de-grupo.md)
- [Definir tema de grupo](https://gowa-docs.mintlify.site/es/api-reference/group/definir-tema-de-grupo.md)
- [Establecer modo de anuncio de grupo](https://gowa-docs.mintlify.site/es/api-reference/group/establecer-modo-de-anuncio-de-grupo.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.