Skip to content

dialpad/dx-android-clients

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Ai Chatbot

Chatbot support for native Android mobile apps

This library provides an SDK to easily integrate an AI Chatbot into your native Android applications.

Key Features

  • Bi-directional Communication:
    • Your Android app can send commands to the chatbot using DialpadChatbotCommand.
    • The chatbot can send events to your Android app using DialpadChatbotEvent.
  • Compose Support: The SDK includes a DialpadChatbotView Composable function for easy integration with Jetpack Compose.
  • WebView-based Implementation: Leverages WebView for rendering the chatbot interface.

Usage

Installation guide

Visit this page for more information.

Integrating the Chatbot View

Use the DialpadChatbotView Composable to display the chatbot within your app.

@Composable
fun MyChatbotScreen() {
    val commands = remember { MutableSharedFlow<DialpadChatbotCommand>() }

    DialpadChatbotView(
        url = "YOUR_CHATBOT_URL", // Replace with your chatbot URL
        modifier = Modifier.fillMaxSize(),
        commands = commands,
        onEvent = { event ->
            when (event) {
                DialpadChatbotEvent.SessionStarted -> {
                    // Handle session started event
                }
                DialpadChatbotEvent.SessionEnded -> {
                    // Handle session ended event
                }
            }
        }
    )
}

Parameters:

  • url: The URL of the Chatbot to be loaded in the WebView.
  • modifier: Modifier for the layout of the WebView.
  • commands: A SharedFlow of DialpadChatbotCommand to send commands to the Chatbot.
  • onEvent: A callback function to receive DialpadChatbotEvent from the Chatbot.

Sending Commands to the Chatbot

Use the commands SharedFlow to send commands to the chatbot. For example, to end a session:

scope.launch {
    commands.emit(DialpadChatbotCommand.EndSession)
}

Supported Events:

  • DialpadChatbotEvent.SessionStarted - indicates that a chatbot session has started.
  • DialpadChatbotEvent.SessionEnded - indicates that a chatbot session has ended.

Supported Commands:

  • DialpadChatbotCommand.EndSession - command to end the current chatbot session.

About

📱 Ai Chatbot for Android, for integrating Dialpad Ai Chatbot into your Android application.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages