> For the complete documentation index, see [llms.txt](https://sending-network.gitbook.io/sending.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sending-network.gitbook.io/sending.network/sdk-documentation/bot-sdks/golang-bot-sdk/room.md).

# Room

### **Create room**

```go
func (cli *Client) CreateRoom(req *ReqCreateRoom) (resp *RespCreateRoom, err error)
```

Parameters:

| Name                | Type      | Description                                                      | Required |
| ------------------- | --------- | ---------------------------------------------------------------- | -------- |
| req.Name            | string    | room name                                                        | false    |
| req.RoomAliasName   | string    | room alias name                                                  | false    |
| req.Topic           | string    | room topic                                                       | false    |
| req.Invite          | \[]string | a list of user IDs to invite to the room                         | false    |
| req.CreationContent | string    | extra keys to be added to the content of the m.room.create event | false    |

Returns:

| Name        | Type   | Description             | Required |
| ----------- | ------ | ----------------------- | -------- |
| resp.RoomID | string | id for the created room | true     |
| err         | error  | error message           | true     |

## **Join room**

```go
func (cli *Client) JoinRoom(roomIDorAlias string) (resp *RespJoinRoom, err error)
```

Parameters:

| Name          | Type   | Description      | Required |
| ------------- | ------ | ---------------- | -------- |
| roomIDorAlias | string | room id or alias | true     |

Returns:

| Name        | Type   | Description            | Required |
| ----------- | ------ | ---------------------- | -------- |
| resp.RoomID | string | id for the joined room | true     |
| err         | error  | error message          | true     |

## **Leave room**

```go
func (cli *Client) LeaveRoom(roomID string) (resp *RespLeaveRoom, err error)
```

Parameters:

| Name   | Type   | Description | Required |
| ------ | ------ | ----------- | -------- |
| roomID | string | room id     | true     |

Returns:

| Name | Type            | Description    | Required |
| ---- | --------------- | -------------- | -------- |
| resp | \*RespLeaveRoom | empty response | true     |
| err  | error           | error message  | true     |

## Invite user

```go
func (cli *Client) InviteUser(roomID string, req *ReqInviteUser) (resp *RespInviteUser, err error)
```

Parameters:

| Name       | Type   | Description       | Required |
| ---------- | ------ | ----------------- | -------- |
| roomID     | string | room id           | true     |
| req.UserID | string | user id to invite | true     |

Returns:

| Name | Type            | Description    | Required |
| ---- | --------------- | -------------- | -------- |
| resp | \*ReqInviteUser | empty response | true     |
| err  | error           | error message  | true     |

## Kick user

```go
func (cli *Client) KickUser(roomID string, req *ReqKickUser) (resp *RespKickUser, err error)
```

Parameters:

| Name       | Type   | Description     | Required |
| ---------- | ------ | --------------- | -------- |
| roomID     | string | room id         | true     |
| req.UserID | string | user id to kick | true     |
| req.Reason | string | kick reason     | true     |

Returns:

| Name | Type           | Description    | Required |
| ---- | -------------- | -------------- | -------- |
| resp | \*RespKickUser | empty response | true     |
| err  | error          | error message  | true     |

## Send state event

```go
func (cli *Client) SendStateEvent(roomID, eventType, stateKey string, contentJSON interface{}) (resp *RespSendEvent, err error)
```

Parameters:

| Name        | Type   | Description                           | Required |
| ----------- | ------ | ------------------------------------- | -------- |
| roomID      | string | room id                               | true     |
| eventType   | string | the type of event to send.            | true     |
| stateKey    | string | the state\_key for the state to send. | true     |
| contentJSON | string | event content                         | true     |

Returns:

| Name         | Type   | Description          | Required |
| ------------ | ------ | -------------------- | -------- |
| resp.EventID | string | id for the new event | true     |
| err          | error  | error message        | true     |
