BotsAPI

class BotsAPI

Accesses the Bots API by sending user input and parsing the response.

Signature

class BotsAPI(
    application: Application? = null,
    network: Network,
    logger: Logger? = null,
    instrumentationHandler: AgentforceInstrumentationHandler?
)

Constructor

Parameter Type Description
application Application? Android application instance for context
network Network Network interface for API communication
logger Logger? Logging interface implementation
instrumentationHandler AgentforceInstrumentationHandler? Analytics and performance monitoring

Properties

Property Type Description
BOT_ID String Bot identifier constant
SESSION_ID String Session identifier constant

Functions

buildNetworkRequest

@VisibleForTesting
fun buildNetworkRequest(
    conversationRepresentation: ConversationInputRepresentation,
    queryParams: Map<String, Any> = emptyMap()
): NetworkRequest

getAgents

suspend fun getAgents(mockSettings: MutableStateFlow<MockSettings>): AgentforceIdResponse

Retrieve the Bot id

getFollowUpActions

suspend fun getFollowUpActions(
    followUpActionsListInputRepresentation: FollowUpActionsListInputRepresentation,
    mockSettings: MutableStateFlow<MockSettings>? = null
): FollowUpActionsListRepresentation

getRecommendedUtterances

suspend fun getRecommendedUtterances(
    sessionId: String? = null,
    mockSettings: MutableStateFlow<MockSettings>? = null
): RecommendedUtterancesRepresentation

Get recommended utterances

handleDecodeFailure

@VisibleForTesting
fun handleDecodeFailure(ex: Exception, message: String): Error

handleNoDataFailure

@VisibleForTesting
fun handleNoDataFailure(message: String): Error

logO11yFetchAgents

@VisibleForTesting
fun logO11yFetchAgents(startTime: Long, error: Throwable? = null)

Log O11Y_FETCH_AGENTS_MARKER perf o11y.

logO11yPlannerBot

@VisibleForTesting
fun logO11yPlannerBot(startTime: Long?, error: Throwable? = null)

setAdditionalContext

suspend fun setAdditionalContext(
    botId: String,
    sessionId: String?,
    inputRepresentation: ConversationInputRepresentation
): Result<Int>

Sends additional context to the Bots API

Parameters:

Parameter Type Description
botId String ID of the bot to request a response from
sessionId String? ID of the session that is being referenced by the input
inputRepresentation ConversationInputRepresentation ConversationInputRepresentation payload

Nested Types

Companion

object Companion

Contains constants for BOT_ID and SESSION_ID.

Related Documentation