messages

Message

The message function provided by Game Chat includes various services supporting efficient communication between users. This platform is suitable for group chat as well as personal chat, and it enables a simple, fast process of sending and receiving messages. The following describes Game Chat's main message functions and their features.

1. Instant messaging

  • Real-time communication: you can send and receive messages in real time, which minimizes communication delay.

  • Supporting multiple devices: you can send and receive messages on various devices such as smartphones, tablets, PCs, and so on.

2. Group chat

  • Multiple participants: you can create a group chat that many people can participate in to share information and enhance communication within the team.

  • Manage channel: the admin can add or delete members through the group chat, and adjust the group settings.

3. File sharing

  • Supporting various file formats: you can easily share files in diverse formats such as texts, images, videos, and documents through the chat.

  • Safe file storage: Game Chat saves and manages files in your Object Storage, preventing any information leaks.

4. Message search

  • Keywords search: you can use a specific keyword to search for the past conversation content in the chat.

  • Advanced filter options: you can quickly find the messages you want to search for by applying various filters, such as date, participant, and file format.

5. Notification adjustments

  • Push notifications: when a new message or an important update occurs, a notification is sent to the user to prevent information omission.

  • Notification setting: you can adjust the type and frequency of notification to receive the information in a desired way.

6. Security and personal information protection

  • Data encryption: all messages are encrypted during transmission and storage to prevent data leaks from the outside.

  • Protecting personal information: personal information and dialogs of the user are strictly protected, and are not disclosed to any third party without the consent of the user.

The message function of Game Chat promotes easy and efficient communication of the user, and has an important role in business and daily life. These functions promote easy user communication, and enhance teamwork.

Forward message

If you have created and joined a channel, you can send a new message by calling the following:

const message = 'Hello !!!';
await nc.sendMessage(
        channelId: CHANNEL_ID,
        type:"text",
        content: message
);


// When replying to a message
await nc.sendMessage(
        channelId: CHANNEL_ID,
        type:"text",
        content: message,
        parentMessageId: [MESSAGE_ID]
        );

// When an automatic translation is required for a message
await nc.sendMessage(
        channelId: CHANNEL_ID,
        type:"text",
        content: message,
        translate: true
        );

// In a new message, the contents of the parent message are reinforced and sent with parent_message as shown below.
{
    "id": "message_id",
    "text": "Message",
    "parent_message_id": "first_message_id",
    "parent_message": {
        "id": "message_id",
        "text": "message_name",
        "sender" : {
            "id" : "Sender",
             "name" : "Sender Nickname",
             "profile" : "profile url"
        }
    }
}

Note

If you send/receive messages in JSON format, you can use various user-defined values.

Hashtable messageArray = new Hashtable
{
    { "channel_id", "channelId" },
    { "state", 1 },
    { "desc" , "Desc" }
};
// Convert the message to plain text.
const jsonString = JsonConvert.SerializeObject(messageArray);
// Convert the received message to an array.
Hashtable hashtable = JsonConvert.DeserializeObject<Hashtable>(jsonString);
IDTypeDescription

CHANNEL_ID

string

Channel ID

type

string

Type of the message to send (text or image)

MESSAGE

string

Transfer message text; can be used in various ways if utilizing JSON String

MENTIONS

array

ID of the user to mention

  • Using Express Message: this function is only for sending messages at high speed. By removing all parts that may cause a delay, messages can be transferred 10 times faster than with the previous method. The difference from normal sendMessage is as follows:

FunctionDescriptionFilteringBlockTranslate

sendMessage

Send normal messages

O

O

O

sendExpressMessage

Send express messages

X

X

X

Available to use for any service that requires real-time PvP production or high-speed broadcasting within the game.

Upload files

  • You can transfer files to a specific channel.

  • You can only upload allowed file types by navigating to Dashboard > Settings > Security.

await nc.sendFile([CHANNEL_ID],file);
IDTypeDescription

CHANNEL_ID

string

Channel ID

file

string

File information

Note

  • Object Storage must be enabled.

  • You can use it after integrating with the Object Storage product.

  • When uploading, set the upload type and upload size, etc. in Set Project > Security Settings in the dashboard.

  • Supported file types: all general types such as images, videos, documents, and zips are supported. For an extension that needs to be supported additionally, send inquiries through Contact us, and we will add it after reviewing its security.

  • When using the file link, the Endpoint address is https://apps.ncloudchat.naverncp.com. For example, https://apps.ncloudchat.naverncp.com/archive/[archiveId]

Message information

  • Message Data Class

IDTypeDescription

id

string

ID (unique)

message_id

string

Message ID

sort_id

string

ID for sorting messages

message_type

string

Message type

sender.id

string

Sender ID

sender.name

string

Sender name

sender.profile

string

Sender's profile image

metions

string

List of mentions

metions_everyone

string

Whether everyone's mentioned

content

string

Message

created_at

string

Creation date

sended_at

string

Sent date

Individual message information

You can get information about individual messages.

NBaseSDK.Message message = await nc.getMessage([CHANNEL_ID], [MESSAGE_ID]);

All messages information

You can get information on all messages.

Hashtable filter = new Hashtable
{
    { "channel_id", [CHANNEL_ID] }
};
Hashtable sort = new Hashtable
{
    { "sort_id", -1 }
};
Hashtable option = new Hashtable
{
    { "offset", 0 },
    { "per_page", 10 }
};
var messages = await nc.getMessages(filter, sort, option);
if (messages != null)
    {
            foreach (var message in messages.edges)
        {
            string id = message.Node.message_id.ToString();
            Console.WriteLine("[CloudChatSample] id={0}", id);
        }
    }
  • Parameters

IDTypeDescriptionRequired

filter

object

Search is available for all fields of a query through filtering

O

sort

object

Define a filter for the fields you want to sort

X

option

object

See the following when there are options

X

  • Filter

    IDTypeDescription

    message_id

    String

    Message ID

    channel_id

    String

    Channel ID

    sort_id

    String

    Sort ID

    message_type

    String

    Message Type입

    embedProviders

    String

    Embed Provider

    isExpress

    Boolean

    Immediate Message Status

    bytes

    Int

    Message Byte Size

    content

    String

    Message Content

    sended_at

    String

    Message Send Time

    created_at

    String

    Message Creation Time

  • Sotr

    IDTypeDescription

    created_at

    number

    Creation Date (Ascending '1', Descending '-1')

  • Options

IDTypeDescription

offset

number

Start offset

per_page

number

Number of items returned (up to 100)

Unread messages

Return the number of unread messages. Send the information of the last read message through markRead first.

nc.markRead([CHANNEL_ID], new NBaseSDK.MarkInput
{
    user_id = USER_ID,
    message_id = MESSAGE_ID,
    sort_id = SORT_ID
});
// Return the number of unread messages after being marked.
var unread = nc.unreadCount([CHANNEL_ID]);
IDTypeDescription

USER_ID

string

Enter the user_id contained in the message

MESSAGE_ID

string

Enter the message_id contained in the message

SORT_ID

string

Enter the sort_id contained in the message

Delete message

You can delete messages you sent within the channel.

await nc.deleteMessage([CHANNEL_ID], [MESSAGE_ID]);
  • Parameters

IDTypeDescription

CHANNEL_ID

string

Channel ID

MESSAGE_ID

string

Message ID

Last updated