# Room

## Create Room

```typescript
public createRoom(properties: RoomCreateOptions = {}): Promise<string>
```

Input params：`RoomCreateOptions`

| Name   | Type         | Description                 | Required |
| ------ | ------------ | --------------------------- | -------- |
| name   | string       | room name                   | true     |
| topic  | string       | room topic                  | false    |
| invite | string array | array of user ids to invite | false    |

Output params:

| Name   | Type   | Description        | Required |
| ------ | ------ | ------------------ | -------- |
| roomId | string | id of the new room | true     |

## Invite User

```typescript
public inviteUser(userId, roomId)
```

Input params:

| Name   | Type   | Description | Required |
| ------ | ------ | ----------- | -------- |
| roomId | string | room id     | true     |
| userId | string | user id     | true     |

Output params: N/A

## **Revoke invitation**

```typescript
public revoke(userId, roomId)
```

Input params:

| Name   | Type   | Description | Required |
| ------ | ------ | ----------- | -------- |
| roomId | string | room id     | true     |
| userId | string | user id     | true     |

Output params: N/A

## Kick User

```typescript
public kickUser(userId, roomId, reason = null)
```

Input params:

| Name   | Type   | Description   | Required |
| ------ | ------ | ------------- | -------- |
| roomId | string | room id       | true     |
| userId | string | user id       | true     |
| reason | string | invite reason | false    |

Output params: N/A

## Join Room

```typescript
public joinRoom(roomId: string): Promise<string>
```

Input params：

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

Output params: N/A

## Leave Room

```typescript
public leaveRoom(roomId: string, reason?: string)
```

Input params：

| Name   | Type   | Description  | Required |
| ------ | ------ | ------------ | -------- |
| roomId | string | room id      | true     |
| reason | string | leave reason | false    |

Output params: N/A

## Get Room Memebers

```typescript
 public getAllRoomMembers(roomId: string, atToken?: string): Promise<MembershipEvent[]>
```

Input params:

| Name    | Type   | Description                          | Required |
| ------- | ------ | ------------------------------------ | -------- |
| roomId  | string | room id                              | true     |
| atToken | string | optional batch token, null for "now" | true     |

Output params:

| Name               | Type                     | Description           | Required |
| ------------------ | ------------------------ | --------------------- | -------- |
| MembershipEvent\[] | array of MembershipEvent | membership event data | true     |


---

# Agent Instructions: 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://sending-network.gitbook.io/sending.network/sdk-documentation/node.js-sdk/room.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.
