Manage channel updates

Update channel metadata and receive real-time change events.

Requires App Context

Enable App Context for your keyset in the Admin Portal.

Update channel details​

Edit channel metadata with Update() or UpdateChannel().

Both methods produce the same result. Call Update() on a Channel object or UpdateChannel() on the Chat object with the channel ID.

Method signature​

These methods take the following parameters:

  • Update()

    1channel.Update(ChatChannelData updatedData)
    2
    3public class ChatChannelData
    4{
    5 public string Name { get; set; } = string.Empty;
    6 public string Description { get; set; } = string.Empty;
    7 public Dictionary<string, object> CustomData { get; set; } = new ();
    8 public string Status { get; set; } = string.Empty;
    9 public string Type { get; set; } = string.Empty;
    10}
  • UpdateChannel()

    1chat.UpdateChannel(
    2 string channelId,
    3 ChatChannelData updatedData
    4)
    5
    6public class ChatChannelData
    7{
    8 public string Name { get; set; } = string.Empty;
    9 public string Description { get; set; } = string.Empty;
    10 public Dictionary<string, object> CustomData { get; set; } = new ();
    11 public string Status { get; set; } = string.Empty;
    12 public string Type { get; set; } = string.Empty;
    13}

Input​

channelId#
Type: string
Default: no default
Unique channel identifier.
Required in Update()
No
Required in UpdateChannel()
Yes
property of channelId: Name#
Type: string
Default: no default
Display name for the channel.
Required in Update()
No
Required in UpdateChannel()
No
property of channelId: Description#
Type: string
Default: no default
Additional details about the channel.
Required in Update()
No
Required in UpdateChannel()
No
property of channelId: CustomData#
Type: Dictionary<string, object>
Default: no default
JSON providing custom data about the channel. Values must be scalar only; arrays or objects are not supported. App Context filtering language doesn’t support filtering by custom properties.
Required in Update()
No
Required in UpdateChannel()
No
property of channelId: Status#
Type: string
Default: no default
Tag that categorizes a channel by its state, like archived.
Required in Update()
No
Required in UpdateChannel()
No
property of channelId: Type#
Type: string
Default: no default
Tag that categorizes a channel by its function, like offtopic.
Required in Update()
No
Required in UpdateChannel()
No
API limits

To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.

Output​

An awaitable Task<ChatOperationResult>.

Sample code​

Update the description of the support channel.

  • Update()

    1
    
  • UpdateChannel()

    1
    

Get channel updates​

Receive updates when Channel objects are edited or deleted:

  • StreamUpdates() - monitors a single channel
  • StreamUpdatesOn() - monitors multiple channels

Both methods accept a callback invoked when channel metadata changes. They subscribe to a channel and add an objects event listener for channel events.

Call StreamUpdates(true) to enable the OnUpdated and OnDeleted events on the channel entity. OnUpdated fires when channel metadata changes. OnDeleted fires when the channel is hard-deleted from App Context.

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()

    1channel.StreamUpdates(bool stream)
  • OnUpdated

    1// event on the Channel entity
    2public event Action<Channel> OnUpdated;
    3// needs a corresponding event handler
    4void EventHandler(Channel channel)
  • OnDeleted

    1// event on the Channel entity
    2public event Action OnDeleted;
    3// needs a corresponding event handler
    4void EventHandler()
  • StreamUpdatesOn() (static)

    1Channel.StreamUpdatesOn(
    2 List<Channel> channels,
    3 Action<Channel> listener
    4)

Input​

stream#
Type: bool
Default: no default
Whether to start (true) or stop (false) listening to Channel object updates.
Required in StreamUpdates()
Yes
Required in OnUpdated / OnDeleted
n/a
Required in StreamUpdatesOn()
n/a
channels#
Type: List<Channel>
Default: no default
List of Channel objects for which you want to get updates.
Required in StreamUpdates()
No
Required in OnUpdated / OnDeleted
No
Required in StreamUpdatesOn()
Yes
listener#
Type: Action<Channel>
Default: no default
Callback that receives the specific channel that was updated.
Required in StreamUpdates()
No
Required in OnUpdated / OnDeleted
No
Required in StreamUpdatesOn()
Yes

Output​

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

Sample code​

  • StreamUpdates() and OnUpdated

    Get updates on the support channel.

    1
    
  • StreamUpdatesOn()

    Get updates on the support and incidentManagement channels.

    1
    

Was this page useful?

Last updated on