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

# グループ管理

> グループの作成、参加者と管理者の管理、参加リクエストの処理、設定の変更、グループへの送信など。

すべてのグループルートはデバイス単位です。`X-Device-Id` を送信してください。グループ ID は、`120363025246125486@g.us` のように `@g.us` で終わる JID です。管理操作には、アカウントがグループ管理者である必要があります。

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

## 作成と検査

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

## 参加者

同じボディは、追加、削除、促進、およびデモに使用できます。

```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は、プライバシー設定のために直接誰かを追加することを拒否することができます。代わりに招待リンクを送信します。

## 参加リクエスト

管理者の承認が必要なグループ:

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

## 設定

| 設定 | Endpoint | 本文 |
| - | - | - |
| 名前 | `POST /group/name` | `{"group_id": "...", "name": "New name"}` |
| 説明 | `POST /group/topic` | `{"group_id": "...", "topic": "About this group"}` (empty removes it) |
| 写真 | `POST /group/photo` | multipart: `group_id` , `photo` (削除するには `photo` を省略) |
| 管理者のみ情報を編集 | `POST /group/locked` | `{"group_id": "...", "locked": true}` |
| 管理者のみ送信 | `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}'
```

## 招待リンク

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

## グループにメッセージを送信中

各 `/send/*` エンドポイントでは、グループの JID を `phone` に指定してください。メンバーをメンションするには `mentions` を、全員をメンションするには `"@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"]}'
```

## グループイベント

`group.participants`を購読（参加、休暇、プロモート、demote）と`group.joined`（あなたは追加されました）ウェブフック。ペイロードの例：

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

- [メッセージを取り消す](https://gowa-docs.mintlify.site/ja/api-reference/message/メッセージを取り消す.md)
- [グループロック状態を設定](https://gowa-docs.mintlify.site/ja/api-reference/group/グループロック状態を設定.md)
- [グループアナウンスモードの設定](https://gowa-docs.mintlify.site/ja/api-reference/group/グループアナウンスモードの設定.md)
- [招待リンクからグループ情報を取得します](https://gowa-docs.mintlify.site/ja/api-reference/group/招待リンクからグループ情報を取得します.md)
- [グループ情報](https://gowa-docs.mintlify.site/ja/api-reference/group/グループ情報.md)


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