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.


Under the hood

Method signature

These methods take the following parameters:

  • forward()

    channelId: string
    ): Promise<void>
  • forwardMessage()

    message: Message
    ): Promise<void>


ParameterTypeRequired in forward()Required in forwardMessage()DefaultDescription
channelIdstringYesNon/aUnique 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.
messageMessageNoYesn/aMessage object that you want to forward to the selected channel.


Promise<void>Method returns no output data.


Whenever the channel ID or the message is required as a parameter, and you try to forward the message without providing it, you will receive the Channel ID is required or the Message is required error.

Basic usage

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

  • forward()

    // reference the channel with the message you want to forward
    const channel = await chat.getChannel("support")

    // reference the "message" object you want to forward
    const message = await channel.getHistory({count: 1}).messages[0]

    // use the "forward()" method to send the message to the "incident-management" channel
    await message.forward("incident-management")
  • forwardMessage()

    // reference the "support" channel with the message you want to forward
    const originalChannel = await chat.getChannel("support")

    // reference the last message on that "support" channel
    const lastMessage = await originalChannel.getHistory({count: 1}).messages[0]

    // reference the "incident-management" channel to which you want to forward the message
    const newChannel = await chat.getChannel("incident-management")

    // use the "forwardMessage()" method to send the message to the "incident-management" channel
    await newChannel.forwardMessage(lastMessage)
Last updated on