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​

channelId#
Type: String
Default: no default
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.
Required for Message
Yes
Required in Channel
No
message#
Type: MessageImpl
Default: no default
MessageImpl object that you want to forward to the selected channel.
Required for Message
No
Required in Channel
Yes

Output​

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
    

Was this page useful?

Last updated on