MessageDraftV2 object
MessageDraftV2 represents a message that has not been published yet.
Message draft versions
Version 2 provides a more generic way to work with user mentions, channel references, and links ("message elements"). Refer to Drafts (v2) and Drafts (v1).
- Version 2
- Version 1
MessageDraftV2 has the following properties:
1class MessageDraftV2 {
2 channel: Channel,
3 value: string,
4 quotedMessage?: Message,
5 config: MessageDraftConfig,
6 files?: FileList | File[] | SendFileParameters["file"][];
7}
| Parameter | Description |
|---|---|
channelType: Channel | The channel the draft message is being created on. |
valueType: string | Message that includes mentions. |
quotedMessageType: Message or undefined | Object added to a draft message when you quote another message. |
configType: MessageDraftConfig | Configuration of the message containing mentions - what is the user source (channel members or app's keyset users), whether the typing indicator is enabled, and what is the maximum number of user names mentioned in one message (the default value is 10 and max is 100). |
filesType: FileList or File[] or SendFileParameters["file"][], or undefined | One or multiple files attached to the draft text message. They can take the form of a read-only files property of the HTML <input /> element (when a user has selected one or more files from their device), or through a drag-and-drop operation (FileList). Alternatively, that can be an array of file objects (File[]) or PubNub-specific `SendFileParameters["file"][]. |
Methods
Available methods:
MessageDraft has the following properties:
1class MessageDraft {
2 value: string,
3 quotedMessage?: Message,
4 config: MessageDraftConfig,
5 files?: FileList | File[] | FileInput[]
6}
| Parameter | Description |
|---|---|
valueType: string | Message that includes mentions. |
quotedMessageType: Message or undefined | Object added to a draft message when you quote another message. |
configType: MessageDraftConfig | Configuration of the message containing mentions - what is the user source (channel members or app's keyset users), whether the typing indicator is enabled, and what is the maximum number of user names mentioned in one message (the default value is 10 and max is 100). |
filesType: FileList, File[], FileInput[], or undefined | One or multiple files attached to the draft text message. They can take the form of a read-only files property of the HTML <input /> element (when a user has selected one or more files from their device), or through a drag-and-drop operation (FileList). Alternatively, that can be an array of file objects (File[]) or PubNub-specific FileInput (FileInput[]). |
Methods
Available methods:
Use case
MessageDraftV2 methods enable users to prepare draft messages with:
- Links
- User mentions with
@ - Channel references with
#