messages.forwardToUser()

This method allows you to forward a message to a User with or without priority.

It is required to specify the organizationId option, since conversations with the same user can be present in different organizations.

Definition

client.messages.forwardToUser(
messageId: string|Object,
entityId: string,
options: ?Object
)

Parameters

ParameterTypeDescription
messageIdstring|MessageA message ID or message object that is to be forwarded
entityIdstringUser ID who that message should be forwarded to
options?ObjectOptions (described below)

Options

ParameterTypeDescription
organizationIdstringThe organization in which the message should be sent
priority?stringIndicates priority level of message. Values: NORMAL (default), HIGH
senderId?stringID of the user who is forwarding the message, default is current user

Returns

An error will be thrown if the messageId or entityId are invalid.

Otherwise, once the returned Promise is resolved, you will have a newly forwarded Message.

Example

Forward to user with normal priority:

const forwardedMessage = await client.messages.forwardToUser(
'some-message-id',
'some-user-id-to-forward-to',
{
organizationId: 'some-org-id',
priority: client.enums.MessagePriority.NORMAL
}
);
console.log(
'forwarded message to', forwardedMessage.counterParty.name,
'with priority of ', forwardedMessage.priority,
'original message from', forwardedMessage.originalSender.name
);