On this page

Forward messages

Forward messages between channels to share information or facilitate collaboration.

Use the forward() method on a message object or a channel object. Both produce the same result with different input parameters.

Additional info in the forwarded message

Forwarded messages include originalPublisher (original sender's user ID) and originalChannelId (source channel ID).

Method signature

These methods take the following parameters:

  • forward() (on the Message object)

    1message.forward(
    2 channelId: String
    3) async throws -> Timetoken
  • forward() (on the Channel object)

    1channel.forward(
    2 message: MessageImpl
    3) async throws -> Timetoken

Input

ParameterRequired for MessageRequired in ChannelDescription
channelId
Type: String
Default:
n/a
Yes
No
Unique identifier of the channel to which you want to forward the message. You can forward a message to the same channel on which it was published or to any other.
message
Type: MessageImpl
Default:
n/a
No
Yes
MessageImpl object that you want to forward to the selected channel.

Output

ParameterDescription
Timetoken
Timetoken of the forwarded message.

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.

Forward the latest message from the support channel to the incident-management channel.

  • forward() (on the Message object)

    1
    
  • forward() (on the Channel object)

    1
    
Last updated on