On this page

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 to a message.

Properties

The MessageDraft object has the following properties:

1public class MessageDraft
2{
3 public string Text { get; }
4 public List<MessageElement> MessageElements { get; }
5 public bool ShouldSearchForSuggestions { get; set; }
6}
ParameterDescription
Text
Type: string
The current text of the draft.
MessageElements
Type: List<MessageElement>
The current message elements.
ShouldSearchForSuggestions
Type: bool
Whether the MessageDraft should search for suggestions whenever the text is changed.

Events

The MessageDraft object has the following events:

1// Event triggered when a message draft is updated
2public event Action<List<MessageElement>, List<SuggestedMention>> OnDraftUpdated;

Example

Insert suggested mentions when updating a message draft.

1

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