Manage message updates
Edit messages and receive real-time update events.
Requires Message Persistence
Enable Message Persistence in the Admin Portal.
Edit messages
EditMessageText() replaces an existing message's content.
Method signature
This method takes the following parameters:
1message.EditMessageText(string newText)
Input
| Parameter | Description |
|---|---|
newText *Type: stringDefault: 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 singleMessageobjectStreamUpdatesOn()- updates for multipleMessageobjects
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) -
OnUpdated1// 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
| Parameter | Required in StreamUpdates() | Required in OnUpdated | Required in StreamUpdatesOn() | Description |
|---|---|---|---|---|
streamType: boolDefault: n/a | Yes | n/a | n/a | Whether to start (true) or stop (false) listening to Message object updates. |
messagesType: List<Message>Default: n/a | No | No | Yes | List of Message objects for which you want to get updates. |
listenerType: 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()andOnUpdatedGet message and message reaction-related updates for all messages published on the
supportchannel.1 -
StreamUpdatesOn()Get message and message reaction-related updates for messages from the
supportchannel.1