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 theMessageobject)1message.forward(
2 channelId: String
3) async throws -> Timetoken -
forward()(on theChannelobject)1channel.forward(
2 message: MessageImpl
3) async throws -> Timetoken
Input
| Parameter | Required for Message | Required in Channel | Description |
|---|---|---|---|
channelIdType: StringDefault: 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. |
messageType: MessageImplDefault: n/a | No | Yes | MessageImpl object that you want to forward to the selected channel. |
Output
| Parameter | Description |
|---|---|
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 theMessageobject)1 -
forward()(on theChannelobject)1