On this page

Pinned messages

Pin messages to channels for easy access. Only one message can be pinned per channel at a time.

Use cases:

  • Essential announcements and updates
  • Action items and reminders
  • Polls and persistent questions
Requires App Context and Message Persistence

Pin

Pin() and PinMessage() attach a message to the channel.

Both of these methods give the same result. The only difference between them is that you may or may not be required to provide input parameters, and you call them on different objects: message (Pin()) or channel (PinMessage()).

Alternatively, you can also use other Unity Chat SDK methods to pin a message in a thread (thread message) to the thread channel or the parent channel.

Method signature

These methods take the following parameters:

  • Pin()

    1message.Pin()
  • PinMessage()

    1channel.PinMessage(Message message)

Input

ParameterRequired in Pin()Required in PinMessage()Description
message
Type: Message
Default:
n/a
No
Yes
Message object that you want to pin to the selected channel.

Output

An awaitable Task<ChatOperationResult>.

Sample code

Pin the last message on the incident-management channel.

  • Pin()

    1
    
  • PinMessage()

    1
    

Get

GetPinnedMessage() fetches the message that is currently pinned to the channel.

Method signature

1channel.GetPinnedMessage()

Input

This method doesn't take any parameters.

Output

ParameterDescription
Task<ChatOperationResult<Message>>
Type: out Message
An awaitable Task with the Message object if a pinned message exists, otherwise the Error property on the result will be true.

Sample code

Get the message pinned to the incident-management channel.

1

Unpin

UnpinMessage() unpins a message from the channel.

Alternatively, you can also use other Unity Chat SDK methods to unpin a message in a thread (thread message) from the thread channel or the parent channel.

Method signature

This method has the following signature:

1channel.UnpinMessage()

Input

This method doesn't take any parameters.

Output

An awaitable Task<ChatOperationResult>.

Sample code

Unpin the message from the incident-management channel.

1

Last updated on