MessageDraft object

MessageDraft is an object that refers to a single message that has not been published yet. Message drafts allow you to mention users, reference channels, and add URLs and files to a message.

Properties

The MessageDraft object has the following properties:

interface MessageDraft {
val channel: Channel
val userSuggestionSource: UserSuggestionSource
val isTypingIndicatorTriggered: Boolean
val userLimit: Int
val channelLimit: Int
var quotedMessage: Message?
val files: MutableList<InputFile>
}
ParameterTypeDescription
channelChannelThe Channel where this Message Draft will be published.
userSuggestionSourceUserSuggestionSourceThis parameter refers to the Mentions feature. Data source from which you want to retrieve users. You can choose either the list of channel members (UserSuggestionSource.CHANNEL) or users on the app's Admin Portal keyset (UserSuggestionSource.GLOBAL).
isTypingIndicatorTriggeredBooleanThis parameter refers to the Typing Indicator feature. Defines if the typing indicator should be enabled when writing the message.
userLimitIntThis parameter refers to the Mentions feature. Maximum number of usernames (name field from the User object) you can mention in one message (the default value is 10 and max is 100).
channelLimitIntThis parameter refers to the References feature. Maximum number of channel names (name field from the Channel object) you can reference in one message (the default value is 10 and max is 100).
quotedMessageMessage or undefinedObject added to a draft message when you quote another message.
filesMutableList<InputFile>One or multiple files attached to the draft text message.

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