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​

ParameterRequired in Update()Required in UpdateChannel()Description
channelId
Type: string
Default:
n/a
NoYesUnique channel identifier.
> Name
Type: string
Default:
n/a
NoNoDisplay name for the channel.
> Description
Type: string
Default:
n/a
NoNoAdditional details about the channel.
> CustomData
Type: Dictionary<string, object>
Default:
n/a
NoNoJSON 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.
> Status
Type: string
Default:
n/a
NoNoTag that categorizes a channel by its state, like archived.
> Type
Type: string
Default:
n/a
NoNoTag that categorizes a channel by its function, like offtopic.
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​

ParameterRequired in StreamUpdates()Required in OnUpdated / OnDeletedRequired in StreamUpdatesOn()Description
stream
Type: bool
Default:
n/a
Yesn/an/aWhether to start (true) or stop (false) listening to Channel object updates.
channels
Type: List<Channel>
Default:
n/a
NoNoYesList of Channel objects for which you want to get updates.
listener
Type: Action<Channel>
Default:
n/a
NoNoYesCallback that receives the specific channel 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 updates on the support channel.

    1
    
  • StreamUpdatesOn()

    Get updates on the support and incidentManagement channels.

    1
    

Was this page useful?

Last updated on