# 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](https://chatme.gitbook.io/chatme/network-info) 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](https://chatme.gitbook.io/chatme/network-info) 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
```
