messages.previewMessage()
Create a temporary copy of an existing message with the supplied options. The new message will not belong to any conversation until it is sent.
This can be useful when showing a preview of a message that you are about to forward.
When you are finished with the message and do not want to send it, call client.messages.endPreviewMessage().
Definition
client.messages.previewMessage(id: string|Message,?{priority: ?string|?number,}):Promise<Message,Error>
Parameters
Parameter | Type | Description |
---|---|---|
id | string |Message | Message ID or message object that you want to re-send |
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|---|---|
priority | ?string | Priority of the new message; currently we only support changing the priority from NORMAL to HIGH , or keeping the same priority |
Returns
An error will be thrown if any of the arguments are invalid.
Otherwise, once the returned Promise
is resolved, it will return the new message.
Example
const previewMessage = await client.messages.previewMessage('some_message_id',{priority: client.enums.MessagePriority.HIGH});console.log('new message preview', previewMessage.body);