Skip to main content

parameters_kind_data

Webim (Custom Channel API): kind processing​

Each message in Webim has its own type, expressed in the kind parameter.

The platform supports the kind and data parameters you can use to obtain request details.

Request example:

data = {
"chat": {
"id": ch.client_side_id
},
"message": {
"text": text,
"kind": message.kind,
"data": message.data
},
"visitor": {
"id": ch.session.visitor.id
}
}

kind and data values can be processed in a script inside the $request object.

tip
If the kind does not match visitor or file_visitor, an event with the name of that kind (with the body of the request in eventData) must be sent in the script.

Usage example in a script:

theme: /

state: Start
q!: *
a: You said: {{$parseTree.text}}

state: Service message
event: INFO
script:
log($request)
a: {{ $request.data.eventData.message.kind }}