- Clone the project.
- In Android Studio, choose File -> New -> Import Module.
- Done.
Import the module in your project:
import com.delightai.api.ChatBuilder
import com.delightai.api.PollingBuilder
GlobalScope.launch {
val build = ChatBuilder().build()
val pollingBuild = PollingBuilder().build()
val response = build.send(
text = text, // text to DelightAI
webhook_id = webhook_id, // a demo webhook Id, you can use it for testing
user_id = user_id, // user id that send to DelightAI
username = username, // username that send to DelightAI
message_id = message_id) // message id
withContext(Dispatchers.IO) {
val pollingResponse = pollingBuild.polling(webhook_id = response.poll)
if (pollingResponse?.completed == true) {
// do something
}
}
}