---
title: QuickChat
slug: world-sdk-guide/quickchat
docTags: 
createdAt: 2024-09-02T08:34:13.134Z
---

QuickMessage-related functions in the ZepetoWorldContent API can be used to implement the ability to send and receive messages within the world.

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-CQVK9Y3RCQ0Qto6SiDauf-20240904-102414.png)

:::hint{type="danger"}
- This feature is available in a World where multiplayer elements are implemented.
:::



In order to use QuickMessage functions, you must create an import statement as follows.

```typescript
import { ZepetoWorldContent, WorldMultiplayChatContent, QuickMessage } from 'ZEPETO.World';
```



ZepetoWorldContent API provides the following QuickMessage-related functions.

| ### API                                                                                                           | **Description**                                                                                               |
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| ZepetoWorldContent.GetQuickMessageList($onComplete: System.Action$1\<QuickMessage\[]>, $onError: System.Action$1) | Import the QuickMessage list for the current World. (Import which corresponds to the language of the device.) |



It can be used as the code shown below.

```typescript
ZepetoWorldContent.GetQuickMessageList(quickMessageList: QuickMessage[] => {
    // Handling QuickMessage

}, err => {
 
});
```



WorldMultiplayChatContent API enables QuickMessage synchronization in multi-player.

When using the functions below, a chat message is sent and output in the chat window. In addition, if you enable BubbleChat in ZepetoPlayers, you can see that a speech bubble pops up in the app.

| **API**                                   | **Description**                                             |
| ----------------------------------------- | ----------------------------------------------------------- |
| SendQuickMessage($quickId: string)\:void; | Sends a quickId message entered to the multi-player server. |

:::hint{type="danger"}
**❗️ Caution**
If the value of the quickId is different from the existing QuickMessage list, it will not be sent.
:::



QuickMessage class consists of the following components:

```typescript
class QuickMessage extends System.Object {  
    public id: string;  
    public message: string;
}
```



The following is an entire example code that uses functions of QuickMessage features.

```typescript
import { Button } from 'UnityEngine.UI';
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { ZepetoWorldContent, WorldMultiplayChatContent, QuickMessage } from 'ZEPETO.World';


export default class QuickChat extends ZepetoScriptBehaviour {
    
    public quickChatBtn: Button;

    Start() {
        ZepetoWorldContent.GetQuickMessageList(quickMessageList => {
            quickMessageList.forEach((quickMessage: QuickMessage, index: number, array: QuickMessage[]) => {
                console.log(`id = ${quickMessage.id}, message = ${quickMessage.message}`);
            });
        }, err => {
            console.log(`QuickMessage Error: ${err}`);
        });

        // Send "Hi" message
        this.quickChatBtn.onClick.AddListener(() => {
            this.OnClickQuickMessageButton("zw_quickchat_preset_001");
        });
    }

    private OnClickQuickMessageButton(quickId: string) {
        WorldMultiplayChatContent.instance.SendQuickMessage(quickId);
    }
}
```

