Conversation models in the Android SDK

Reference for the Conversation, Message, Source and Page types in the Askocto Android SDK, with every field and enum value.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

These Kotlin types describe conversations and messages. They are plain data classes and match the objects of the REST API, so a field you see here has the same meaning in the conversation endpoints.

Conversation

data class Conversation(
    val id: String,
    val agentId: String,
    val userId: String?,
    val channel: String,
    val status: ConversationStatus,
    val messageCount: Int,
    val createdAt: Instant,
    val updatedAt: Instant,
)
Field Description
id Conversation id, starting conv_.
agentId The agent that handled it, starting agt_.
userId The customer id, starting usr_. null for anonymous visitors.
channel Where it happened. Conversations started by the SDK use the app channel.
status A ConversationStatus value.
messageCount Number of messages so far.
createdAt, updatedAt Timestamps parsed from ISO 8601 UTC strings.

ConversationStatus has three values: OPEN, RESOLVED and HANDOFF. They correspond to open, resolved and handoff in the API.

Message

data class Message(
    val id: String,
    val role: Role,
    val content: String,
    val sources: List<Source>,
    val createdAt: Instant,
)

enum class Role { USER, ASSISTANT }
Field Description
id Message id, starting msg_.
role USER for the customer, ASSISTANT for the agent.
content The message text.
sources The sources the agent used. Empty for user messages.
createdAt When the message was created.

When a human teammate replies after a handoff, that message arrives with the ASSISTANT role, so your UI does not need a separate case for it.

Source and Page

data class Source(val id: String, val title: String)

data class Page<T>(val data: List<T>, val nextCursor: String?)

Page wraps every list the SDK returns. data holds the items and nextCursor is null on the last page. In the SDK it is generic, so conversations returns a page of Conversation and messages returns a page of Message.

Note: Models are immutable. To show a message that is still arriving, build your own UI state from StreamEvent values instead of editing a Message. See Streaming events.

Something unclear or missing? Tell us and we will fix the page.