> For the complete documentation index, see [llms.txt](https://chatme.gitbook.io/chatme/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chatme.gitbook.io/chatme/dev-documentation/groups-and-channels/manage-groups-and-channels.md).

# Manage groups & channels

### **Create new group or channel:**

```
near call $CONTRACT_NAME create_new_group '{"title": String, "image": String, "text": String, "url": String, "group_type": String, "members": Vec<AccountId>, "edit_members": Option<bool>, "moderator": Option<AccountId>}' --accountID $ACCOUNT_ID --deposit 0.25
```

NOTE: Replace *CONTRACT\_NAME* to use one of [our smart-contracts](/chatme/network-info.md) and *ACCOUNT\_ID* to your sender account. Include 0.25 NEAR to create new group or channel.

**Request parameters:**

* **title** (required): Group/channel title.
* **image** (required): IFPS hash for logo. Send empty string if you don't want set logo.
* **text** (required): Text description for your group or channel.
* **url** (required): External URL for your community.
* **group\_type** (required): Value represent your community type. \
  Should be one of follows: "*Private*", "*Public*", "*Channel*".
* **members** (required): Array of community members (NEAR Addresses). For Channel it should be empty array (users should join channel).
* **edit\_members** (optional): Set to false for disable members edit in chatme interface. \
  Default: true.
* **moderator** (optional): NEAR Account that have the same privileges as group/channel owner.

**Response:** Group ID (U32).

### **Edit group or channel:**

```
near call $CONTRACT_NAME edit_group '{"id": u32, "title": String, "image": String, "text": String, "url": String}' --accountID $ACCOUNT_ID
```

NOTE: Replace *CONTRACT\_NAME* to use one of [our smart-contracts](/chatme/network-info.md) and *ACCOUNT\_ID* to your sender account.

**Request parameters:**

* **id** (required): Group/channel id that you edit.
* **title** (required): group or channel title.
* **image** (required): IFPS hash for logo. Send empty string if you don't want set logo.
* **text** (required): Text description for your group or channel.
* **url** (required): External URL for your community.

Group Type can't be changed. To edit community members use methods described below.

### Add new members

```
near call $CONTRACT_NAME owner_add_group_members '{id: u32, members: Vec<AccountId>}' --accountID $ACCOUNT_ID
```

### Remove members

```
near call $CONTRACT_NAME owner_remove_group_members '{id: u32, members: Vec<AccountId>}' --accountID $ACCOUNT_ID
```

### Remove group or channel

Danger - action can't be reverted!

```
near call $CONTRACT_NAME owner_remove_group '{id: u32, confirm_title: String}' --accountID $ACCOUNT_ID
```

### Join Public Group

```
near call $CONTRACT_NAME join_public_group '{id: u32}' --accountID $ACCOUNT_ID
```

### Join Public Channel

```
near call $CONTRACT_NAME join_public_channel '{id: u32}' --accountID $ACCOUNT_ID
```

### Leave Group

```
near call $CONTRACT_NAME leave_group '{id: u32}' --accountID $ACCOUNT_ID
```

### &#x20;Leave Channel

```
near call $CONTRACT_NAME leave_channel '{id: u32}' --accountID $ACCOUNT_ID
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chatme.gitbook.io/chatme/dev-documentation/groups-and-channels/manage-groups-and-channels.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
