> ## 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.

# Pengelolaan Grup

> Buat grup, kelola anggota dan admin, tangani permintaan bergabung, ubah pengaturan, dan kirim pesan ke grup.

Semua route grup memiliki cakupan perangkat: sertakan `X-Device-Id`. ID grup adalah JID berakhiran `@g.us`, misalnya `120363025246125486@g.us`. Tindakan admin mengharuskan akun menjadi admin grup.

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

## Membuat dan memeriksa grup

```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
```

## Anggota

Body yang sama dapat digunakan untuk menambah, menghapus, mengangkat admin, dan mencabut status admin:

```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 dapat menolak penambahan seseorang secara langsung karena pengaturan privasinya. Kirim tautan undangan kepada mereka sebagai gantinya.

## Permintaan bergabung

Untuk grup yang memerlukan persetujuan admin:

```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
```

## Pengaturan

| Pengaturan | Endpoint | Body |
| - | - | - |
| Nama | `POST /group/name` | `{"group_id": "...", "name": "New name"}` |
| Deskripsi | `POST /group/topic` | `{"group_id": "...", "topic": "About this group"}` (kosongkan untuk menghapusnya) |
| Foto | `POST /group/photo` | multipart: `group_id`, `photo` (jangan sertakan `photo` untuk menghapusnya) |
| Hanya admin yang dapat mengedit info | `POST /group/locked` | `{"group_id": "...", "locked": true}` |
| Hanya admin yang dapat mengirim pesan | `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}'
```

## Tautan undangan

```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"}'
```

## Mengirim pesan ke grup

Gunakan JID grup sebagai `phone` pada endpoint `/send/*` mana pun. Sebut anggota dengan `mentions`, atau semua orang dengan `"@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"]}'
```

## Event grup

Berlanggananlah ke webhook `group.participants` (bergabung, keluar, diangkat menjadi admin, dicabut status adminnya) dan `group.joined` (Anda ditambahkan ke grup). Contoh payload:

```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

- [Info Grup](https://gowa-docs.mintlify.site/id/api-reference/group/info-grup.md)
- [Daftar grup saya](https://gowa-docs.mintlify.site/id/api-reference/user/daftar-grup-saya.md)
- [Atur topik grup](https://gowa-docs.mintlify.site/id/api-reference/group/atur-topik-grup.md)
- [Tautan Undangan Grup](https://gowa-docs.mintlify.site/id/api-reference/group/tautan-undangan-grup.md)
- [Atur foto grup](https://gowa-docs.mintlify.site/id/api-reference/group/atur-foto-grup.md)


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