Forward messages
The message forwarding feature lets you resend published messages or conversations to:
-
Share relevant information - you can forward messages or threads with additional relevant context to other users, ensuring efficient knowledge sharing.
-
Collaborate and consult - forwarding messages helps in decision-making by involving those who may have valuable insights and can contribute to ongoing discussions or projects.
You can let users send a given message from one channel to another with Forward()
and ForwardMessage()
.
Both of them give the same output. The only difference is that you call a given method either directly on the message (Forward()
) or the channel (ForwardMessage()
) object. Depending on the object, these methods take different input parameters - you either have to specify the Message
object you want to forward or the ID of the channel where you want to send the message.
Additional info in the forwarded message
Each forwarded message contains additional metadata: originalPublisher
with the user ID of the person who originally published the message (to track its owner) and originalChannelId
with the ID of the channel where the message was originally published.
Method signature
These methods take the following parameters:
-
Forward()
message.Forward(string channelId)
-
ForwardMessage()
channel.ForwardMessage(Message message)
Input
Parameter | Type | Required in Forward() | Required in ForwardMessage() | Default | Description |
---|---|---|---|---|---|
channelId | string | Yes | No | n/a | 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 | Message | No | Yes | n/a | Message object that you want to forward to the selected channel. |
Output
These methods don't return any data.
Basic usage
Forward a message from the support
channel to the incident-management
channel.
-
Forward()
if (!chat.TryGetChannel("support", out var channel))
{
Console.WriteLine("Couldn't find channel!");
return;
};
// reference a message on the "support" channel
if (!channel.TryGetMessage("16686902600029072", out var message))
{
Console.WriteLine("Couldn't find message!");
return;
};
// use the "forward()" method to send the message to the "incident-management" channel
message.Forward("incident-management") -
ForwardMessage()
show all 22 linesif (!chat.TryGetChannel("support", out var originalChannel))
{
Console.WriteLine("Couldn't find original channel!");
return;
};
// reference a message on the "support" channel
if (!originalChannel.TryGetMessage("16686902600029072", out var message))
{
Console.WriteLine("Couldn't find message!");
return;
};
// reference the "incident-management" channel to which you want to forward the message
if (!chat.TryGetChannel("incident-management", out var channel))