Requirements
Install the SDK
Build a UI SDK App
Build a Core SDK App
Manage Conversations
Create an Interface Object
Hide or Replace Messages in a Chat Feed
Define Your UI For Each Type
Sample Apps
Enhanced Chat API Developer Guide
Create an object that inherits from the ViewComponent interface. Pass this to the UI client to define how to treat each ChatFeedEntry type using the EntryRenderMode.
1val entryRenderMode: ((entry: ChatFeedEntry) -> EntryRenderMode) = { entry ->
2 when (entry.contentType) {
3// Display participant changed events using the existing UI
4 ConversationEntryType.ParticipantChanged.name -> EntryRenderMode.Existing
5 // Replace the UI for any Message type entry with the UI you provide
6 ConversationEntryType.Message.name -> EntryRenderMode.None
7 // Ignore RoutingWorkResult type entries
8 ConversationEntryType.RoutingWorkResult.name -> EntryRenderMode.Ignore
9 else -> EntryRenderMode.Existing
10 }
11}
12uiClient.viewComponents = object : ViewComponents {
13 @Composable
14 override fun ChatFeedEntry(entry: ChatFeedEntry, content: @Composable () -> Unit) {
15 when (entryRenderMode(entry)) {
16 EntryRenderMode.None -> Unit
17// Display default content
18 EntryRenderMode.Existing -> content()
19 EntryRenderMode.Replace -> ReplacementEntry(entry, uiClient.conversationClient(appContext))
20 }
21 }
22}All entries of a type are affected by the EntryRenderMode you set for that type. Use this feature with caution! For example, if you choose to hide RoutingWorkResult entries, it affects transfer events and estimated wait time.
Note