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
Parameter | Type | Description |
---|---|---|
messageId | string |Message | A message ID or message object that is to be forwarded |
entityId | string | User ID who that message should be forwarded to |
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|---|---|
organizationId | string | The organization in which the message should be sent |
priority | ?string | Indicates priority level of message. Values: NORMAL (default), HIGH |
senderId | ?string | ID 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);