/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Copy a message

Copy link

A user can copy and send their own message in the same channel or to another channel. This works the same way for both open channels and group channels.

For those who are using messageCollection, copying a message will take place as follows. First, pass a target message to copy and the target channel where the message is located, to the copyMessage() method. Then the SDK creates a pending message using the target message content and let the MessageCollection know that there is a new pending message. If the current user is connected, it adds the message to a message queue and returns the result of the message.

Note: copyUserMessage() and copyFileMessage() methods have been deprecated and now superseded by copyMessage().

User message

Copy link
JavaScriptTypeScript
await channel.copyUserMessage(TARGET_CHANNEL, MESSAGE_TO_COPY);

File message

Copy link
JavaScriptTypeScript
await channel.copyFileMessage(TARGET_CHANNEL, MESSAGE_TO_COPY);

Multiple file message

Copy link
JavaScriptTypeScript
await channel.copyMultipleFilesMessage(TARGET_CHANNEL, MESSAGE_TO_COPY);

List of arguments

Copy link
ArgumentTypeDescription

TARGET_CHANNEL

object

Specifies a target channel to send a copied message to.

MESSAGE_TO_COPY

object

Specifies a message to copy.