Pinned message

Pinned message

In a chat, Pinned Message is a function that pins important messages in a chat room or a group chat to the top of the chat window. This function helps participants see the message easily whenever they open the chat room, and not miss important information or notifications. The following describes the main characteristics of pinned messages and how to use them.

How to use pinned messages

  • Meeting schedule notice: sets the schedule of regular meetings or important events as a pinned message to help participants not forget their schedule.

  • Important document links: pins the links of important documents and materials to allow all participants to access them easily.

  • Rules and guides sharing: sets the rules of the chat room or project guides as a pinned message to allow new participants to check the guides easily.

  • Urgent notification: allows sharing the content that needs to be forwarded urgently or any changes with a pinned message.

The pinned messages function is provided in various communication platforms. When you use it effectively, you can enhance the efficiency of team communication.

Create pinned message

It is a function that pins an important message to the top of the chat application so that users can easily see it. The following C# code shows how to pin messages in the chat channel.

var newPin = await nc.createPin(channelId, messageId, pinned, pinnedAt, expiredAt);
  • channelId: the unique identifier of the chat channel where the message will be pinned.

  • pinned: contents of a message to be pinned.

  • pinnedAt: displays the time when the message is pinned.

  • expiredAt: the time when the message will be unpinned.

When you use this function, you can easily highlight important messages in a specific chat channel.

Edit pinned message

It is a function to update the information of the existing pinned messages. You can change the contents of the message, and the time when the message is pinned and will be unpinned.

var updatedPin = await nc.updatePin(id, channelId, pinned, pinnedAt, expiredAt);
  • channelId: ID of the channel where there are messages to be edited.

  • pinned: the edited message content.

  • pinnedAt: the time when the message is newly pinned.

  • expiredAt: the newly set time when the message will be unpinned.

This code is used to change the details of the messages already pinned. It is useful when the importance of the message is changed or the time set for the message to be pinned needs to be changed.

Pinned message information

It is a function to view the information related to pinning certain messages. You can check the status of the pinned message, and the time when the message is pinned and will be unpinned.

var pin = await nc.getPin(channelId, messageId);
  • channelId: ID of the channel from which to retrieve information.

  • messageId: the unique identifier of the pinned message.

Through this function, you can check the current status of a specific message, which helps the admin or users manage messages in the channel effectively.

Pinned message list

It is a function that views the list of all messages currently pinned in the chat channel. This function supports paging, so the data can be processed efficiently even in a large-scale channel. Users can set offset and per_page to bring up the data in the desired range.

Hashtable filter = new Hashtable
{
    { "channel_id", channelId },
};
Hashtable sort = new Hashtable
{
    { "created_at", -1 },
};
Hashtable option = new Hashtable
{
    { "offset", 0 },
    { "per_page", 10 },
};
var pins = await nc.getPins(channelId, filter, sort, option);

Parameter descriptions

  • Filter: defines the conditions for filtering the data to be viewed. For example, you can view pinned messages in a specific channel.

  • Sort: defines how to sort the results list. Here, sorting in descending (-1) order is used based on the creation time (created_at).

  • Option: defines the options to be used when viewing. offset specifies the location where the view starts, and per_page specifies the number of messages to be shown per page.

Options details

IDTypeDescription

offset

number

Start location where the data will be brought up.

per_page

number

The number of messages to be returned per page, and up to 100 messages can be set.

If you use this function, the channel manager can easily monitor and manage important messages in the channel. Also, the channel manager can quickly find and sort pinned messages based on the specific user or time, which helps operate the channel efficiently.

Last updated