messages.forwardToGroupOfUsers()
This method allows you to forward a message to a new group of Users with or without priority.
It is required to specify the organizationId
option, since conversations with the same users can be present in different organizations.
Definition
client.messages.forwardToGroupOfUsers(messageId: string|Object,userIds: Array<string>|Array<User>,options: ?Object)
Parameters
Parameter | Type | Description |
---|---|---|
messageId | string |Message | A message ID or message object that is to be forwarded |
userIds | Array<string> |Array<User> | Users to add to the new group |
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 userIds
are invalid.
Otherwise, once the returned Promise
is resolved, you will have a newly forwarded Message.
Example
Forward to group of users with normal priority:
const forwardedMessage = await client.messages.forwardToGroupOfUsers('some-message-id',['user-id-1', 'user-id-2'],{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);