MessageDraft object

MessageDraft is an object that refers to a single message that has not been published yet.

Properties

The MessageDraft object has the following properties:

class MessageDraft {
value: string,
quotedMessage?: Message,
config: MessageDraftConfig,
files?: FileList | File[] | FileInput[]
}
ParameterTypeDescription
valuestringMessage that includes mentions.
quotedMessageMessage or undefinedObject added to a draft message when you quote another message.
configMessageDraftConfigConfiguration 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).
filesFileList, File[], FileInput[], or undefinedOne 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[]).
icon

Message draft configuration


Methods

You can call the following methods on the MessageDraft object.

Click on each method for more details.

Use case

For example, you can use the MessageDraft object methods to let users work on the created draft messages to prepare the final content. They can enrich that content with links, mention other channel members with @, or reference channels with #.

Last updated on