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 a channel. Call pin() on a message object or pinMessage() on a channel object.

Alternatively, you can also use other 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() (on the Message object)

    1message.pin() async throws -> ChannelImpl
  • pinMessage() (on the Channel object)

    1channel.pinMessage(
    2 message: MessageImpl
    3) async throws -> ChannelImpl

Input​

ParameterRequired in pin()Required in pinMessage()Description
message
Type: MessageImpl
Default:
n/a
NoYesMessageImpl object that you want to pin to the selected channel.

Output​

ParameterDescription
ChannelImplThe updated channel metadata.

Sample code​

Sample code

The code samples in Swift Chat SDK focus on asynchronous code execution.

You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.

Pin the last message on the incident-management channel.

  • pin()

    1
    
  • pinMessage()

    1
    

Get​

getPinnedMessage() retrieves the currently pinned message.

Method signature​

This method has the following signature:

1channel.getPinnedMessage() async throws -> MessageImpl?

Input​

This method doesn't take any parameters.

Output​

ParameterDescription
MessageImplReturned MessageImpl object.

Sample code​

Sample code

The code samples in Swift Chat SDK focus on asynchronous code execution.

You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.

Get the message pinned to the incident-management channel.

1

Unpin​

unpinMessage() unpins a message from the channel.

Alternatively, you can also use other 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() async throws -> ChannelImpl

Input​

This method doesn't take any parameters.

Output​

ParameterDescription
ChannelImplThe updated channel metadata.

Sample code​

Sample code

The code samples in Swift Chat SDK focus on asynchronous code execution.

You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.

Unpin the message from the incident-management channel.

1

Was this page useful?

Last updated on