-
Notifications
You must be signed in to change notification settings - Fork 39
request
BotRequest contains a channel-related request data and available through request
variable in the action block of the dialogue state.
In general this object contains at least type of the request, user's identifier and an input. Each channel defines its own implementation of BotRequest with additional channel-related request fields. It can be accessed via null-safe invocation of channel extension. For example:
state("main") {
action {
var name = context.client["name"]
if (name == null) {
request.telegram?.run {
name = message.chat.firstName ?: message.chat.username
}
request.facebook?.run {
name = reactions.facebook?.queryUserProfile()?.firstName()
}
}
}
}
JAICF defines three types of the request: query, event and intent.
Channel-related user's identifier is contained in request.cluentId
variable.
request.input
variable contains an input string that corresponds to the request's type.
For event and intent request it is a name of event or intent accordingly. In case of query request this variable contains a raw text of the user's request.