AI Chatbot Guide v1
AI Chatbot
Version 1

Suggested replies

Copy link

Suggested replies is a feature that offers predefined responses to streamline communication within your chat. For example, one-click options like "Yes, it was helpful!" lets users instantly confirm satisfaction, while choosing "Talk to an agent" can connect them directly to customer support for further assistance. This functionality not only speeds up the interaction but also provides clear next steps based on the user's specific needs.

You can set up the suggested replies on Sendbird Dashboard under Application > Chat > AI chatbot > Custom responses > Create response +. Here, you can create a custom response containing suggested replies and connect it with an AI chatbot.


Implement suggested replies

Copy link

You can integrate suggested replies in a group channel by following the code below. It sets up a channel handler that listens for changes in group channels. When a change is detected, it checks if there are any suggested replies attached to the last message.


If suggested replies are present, you have two options:
1. You can either enable the feature and rely on our UIKit to automatically handle the display, or
2. You can write custom code for a more tailored appearance and behavior, as indicated in the placeholder within the code snippet.

AndroidiOSJavaScript
SendbirdChat.addChannelHandler(
    "IDENTIFIER", 
    object : GroupChannelHandler() {
        ...
        override fun onChannelChanged(channel: BaseChannel) {
            if (channel is GroupChannel) {
                val suggestedReplies = channel.lastMessage?.suggestedReplies
                if (!suggestedReplies.isNullOrEmpty()) {
                    // Draw your own suggested replies UI.
                }
            }
        }
    }
)

Enable suggested replies in UIKit

Copy link

You can enable the suggested replies feature in UIKit by following the code below.

AndroidiOSJavaScript
// BaseApplication.kt
UIKitConfig.groupChannelConfig.enableSuggestedReplies = true

Enable horizontal suggested replies in UIKit

Copy link

You can change the direction of the suggested replies layout in UIKit to the horizontal style by following the code below.

AndroidiOSJavaScript
// BaseApplication.kt
// default - SuggestedRepliesDirection.VERTICAL
UIKitConfig.groupChannelConfig.suggestedRepliesDirection = SuggestedRepliesDirection.HORIZONTAL