# Message

## Quick DM

```javascript
window.chatWidgetApi.chatToAddress(address, callback)
```

| Method Name                         | Parameters                                                                                                                      | Return Values |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| window\.chatWidgetApi.chatToAddress | <p>address: Recipient's wallet address</p><p>callback: A callback event that returns true for success and false for failure</p> | N/A           |

## Quick public group chat

```javascript
window.chatWidgetApi.joinPublicRoom(roomID, callback)
```

<table><thead><tr><th width="218">Name</th><th>Description</th><th>Parameters</th><th>Response</th></tr></thead><tbody><tr><td>window.chatWidgetApi.joinPublicRoom</td><td>Automatically join group chat and display the group chat page.</td><td><p>roomId: room ID</p><p>callback(optional):  function</p></td><td>N/A</td></tr></tbody></table>

## Get the number of unread messages

```javascript
window.chatWidgetApi.getUnreadCounts((num)=>{console.log(num)})
```

<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.getUnreadCounts</td><td>Get the number of unread messages</td><td>Callback function: (num)=>{console.log(num)}</td><td>N/A</td></tr></tbody></table>
