Transferring Typing Information

Method

POST https://amojo.kommo.com/v2/origin/custom/{scope_id}/typing

Description

The method provides transferring information that the client is currently typing something in the messenger. The information will be displayed in Kommo interface.

Headers & Authorization type

The request headers are the same as the ones for all Chat API requests. Information about them is explained in details in the connect a chat channel page.

Header Description
Date Date and time when the request was generated.
Content-type Request data type.
Content-MD5 For the request body
X-Signature Signature of the request as a string.

Body example

{
   "conversation_id": "62ef74a4-80c5-403d-93d9-bada6302810f",
   "sender": {
       "id": "209beccc-4f66-46ff-b06f-d245fca1af0a"
   }
}

Body Parameters

Parameter Data type Description
conversation_id string Chat ID on the integration side
sender[id] string User ID on the integration side

Example in PHP

$secret = 'fb50586ff7b68cd831fe0ef356345903f644c0d2';
$method = 'POST';
$contentType = 'application/json';
$date = "Tue, 13 Dec 2022 11:00:00 +0000";
$path = '/v2/origin/custom/f62a0162-46a7-430e-b06c-0ef798d56b21_52fd2a28-d2eb-4bd8-b862-b57934927b38/typing';

$url = "https://amojo.kommo.com" . $path;

$body = [
          'conversation_id' => '30477717-9f3c-4d3f-8101-60327e14dc48',
          'sender' => [
          		'id' => '209beccc-4f66-46ff-b06f-d245fca1af0a'
          ]
];
$requestBody = json_encode($body);

$checkSum = md5($requestBody);

$str = implode("\n", [
    strtoupper($method),
    $checkSum,
    $contentType,
    $date,
    $path,
]);

$signature = hash_hmac('sha1', $str, $secret);

$headers = [
    'Date' => $date,
    'Content-Type' => $contentType,
    'Content-MD5' => strtolower($checkSum),
    'X-Signature' => strtolower($signature),
];

$curlHeaders = [];
foreach ($headers as $name => $value) {
    $curlHeaders[] = $name . ": " . $value;
}

echo $method . ' ' . $url . PHP_EOL;
foreach ($curlHeaders as $header) {
    echo $header . PHP_EOL;
}
echo PHP_EOL . $requestBody . PHP_EOL;

Example of the cURL request

curl --location --request POST 'https://amojo.kommo.com/v2/origin/custom/f62a0162-46a7-430e-b06c-0ef798d56b21_52fd2a28-d2eb-4bd8-b862-b57934927b38/typing' \
--header 'Date: Tue, 13 Dec 2022 11:00:00 +0000' \
--header 'Content-Type: application/json' \
--header 'Content-MD5: d838b28df642e66db8f75d9901ab00ac' \
--header 'X-Signature: 036a53ab9352dcc5f7f6ac6cddbd13acbee122bd' \
--data-raw '{"conversation_id":"62ef74a4-80c5-403d-93d9-bada6302810f","sender":{"id":"209beccc-4f66-46ff-b06f-d245fca1af0a"}}'

Data type header when the request is successful

Content-Type: application/json

Data type header in case of an error

Content-Type: application/json

HTTP Pesponse Codes

Response code Condition
204 Event accepted, the typing status appears
403 Request signature is incorrect
404 Incorrect data transmitted. Details are available in the response body

Response

The method does not return a body in case of successful request, but it appears in Kommo interface that the client is typing.

typing

Chat API uses webhook to send information about messages and typing information. Let’s discuss webhooks next.