# Room

## Create public room

```javascript
window.chatWidgetApi.createPublicRoom(roomName).then((roomID)=>{console.log(roomID)})
```

<table><thead><tr><th width="220">Method Name</th><th>Description</th><th>Parameters</th><th>Return Values</th></tr></thead><tbody><tr><td>window.chatWidgetApi.createPublicRoom</td><td>Create a public group chat with the roomName</td><td>roomName</td><td>roomIDa</td></tr></tbody></table>

## Create private room

```javascript
window.chatWidgetApi.createPrivateRoom(roomName).then((roomID)=>{console.log(roomID)})
```

<table><thead><tr><th width="227">Method Name</th><th>Description</th><th>Parameters</th><th>Return Values</th></tr></thead><tbody><tr><td>window.chatWidgetApi.createPrivateRoom</td><td>Create a private group chat with the roomName</td><td>roomName</td><td>roomID</td></tr></tbody></table>

## **Create DM**

```javascript
window.chatWidgetApi.createDMRoom(userId).then((roomId)=>{console.log(roomId)})
```

| Method Name                        | Description                   | Parameters | Return Values |
| ---------------------------------- | ----------------------------- | ---------- | ------------- |
| window\.chatWidgetApi.createDMRoom | Invite user to a private chat | userId     | roomId        |

## Join a chat room

```javascript
window.chatWidgetApi.joinRoom(roomID)
```

<table><thead><tr><th width="227">Method Name</th><th>Description</th><th>Parameters</th><th>Return Values</th></tr></thead><tbody><tr><td>window.chatWidgetApi.joinRoom</td><td>Join a chat room corresponding to the roomid</td><td>roomID</td><td>N/A</td></tr></tbody></table>

## Invite user to a chat

```javascript
window.chatWidgetApi.invite(roomID, userID)
```

<table><thead><tr><th width="227">Method Name</th><th>Description</th><th>Parameters</th><th>Return Values</th></tr></thead><tbody><tr><td>window.chatWidgetApi.invite</td><td>Invite user to a group chat</td><td><ol><li>roomID</li><li>userID</li></ol></td><td>N/A</td></tr></tbody></table>


---

# 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/website-chat-widget-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.
