On this page

Manage message updates

Edit messages and receive real-time update events.

Requires Message Persistence

Edit messages

EditMessageText() replaces an existing message's content.

Method signature

This method takes the following parameters:

1message.EditMessageText(string newText)

Input

* required
ParameterDescription
newText *
Type: string
Default:
n/a
New/updated text that you want to add in place of the existing message.

Output

An awaitable Task<ChatOperationResult>.

Sample code

Correct the number of the support ticket you sent to 78398.

1

Get message updates

Receive real-time updates when messages or reactions change:

  • StreamUpdates() - updates for a single Message object
  • StreamUpdatesOn() - updates for multiple Message objects

Both methods accept a callback invoked when message content or reactions change. Call StreamUpdates(true) to enable the OnUpdated event on the message entity.

Method naming

Earlier versions used SetListeningForUpdates() to enable streaming. This method has been superseded by StreamUpdates(), though it remains available for backward compatibility.

Method signature

These methods take the following parameters:

  • StreamUpdates()

    1message.StreamUpdates(bool stream)
  • OnUpdated

    1// event on the Message entity — enabled by StreamUpdates()
    2public event Action<Message> OnUpdated;
    3// needs a corresponding event handler
    4void EventHandler(Message message)
  • StreamUpdatesOn() (static)

    1Message.StreamUpdatesOn(
    2 List<Message> messages,
    3 Action<Message> listener
    4)

Input

ParameterRequired in StreamUpdates()Required in OnUpdatedRequired in StreamUpdatesOn()Description
stream
Type: bool
Default:
n/a
Yes
n/a
n/a
Whether to start (true) or stop (false) listening to Message object updates.
messages
Type: List<Message>
Default:
n/a
No
No
Yes
List of Message objects for which you want to get updates.
listener
Type: Action<Message>
Default:
n/a
No
No
Yes
Callback that receives the specific message that was updated.

Output

These methods don't return a value. Updates are delivered through event handlers or callback functions.

Sample code

  • StreamUpdates() and OnUpdated

    Get message and message reaction-related updates for all messages published on the support channel.

    1
    
  • StreamUpdatesOn()

    Get message and message reaction-related updates for messages from the support channel.

    1
    
Last updated on