Disconnecting chat channel

Method

DELETE https://amojo.kommo.com/v2/origin/custom/{channel.id}/disconnect

Description

After disconnecting the channel, you will stop receiving webhooks for outgoing messages.

The “initiate conversation” option will also be disabled in the lead card (upon the expiration of the UI/UX cache)

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.

Example of the body

{
    "account_id": "52fd2a28-d2eb-4bd8-b862-a67934927b38"
}

Body parameters

Parameter Data type Description
account_id string amojo_id of the account

Note: You should write the body in your request exactly the same as written when calculating the headers.

Example in PHP

$secret = 'fb50586ff7b68cd831fe0ef356345903f644c0d2';
$method = 'DELETE';
$contentType = 'application/json';
$date = date(DateTimeInterface::RFC2822);// in format "Wed, 30 Nov 2022 16:33:21 +0000";
$path = '/v2/origin/custom/f62a0162-46a7-430e-b06c-0ef798d56b21/disconnect';

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

$body = [
	'account_id' => '52fd2a28-d2eb-4bd8-b862-a67934927b38'
];

$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 DELETE 'https://amojo.kommo.com/v2/origin/custom/f62a0162-46a7-430e-b06c-0ef798d56b21/disconnect' \
--header 'Date: Wed, 30 Nov 2022 16:33:21 +0000' \
--header 'Content-type: application/json' \
--header 'Content-MD5: 2a3c7cd98696c0388111e2d6b2b694d0' \
--header 'X-Signature: 7a9ce132fff0315dc4b99ce9b2c69bb2dfdb6404' \
--data-raw '{"account_id":"52fd2a28-d2eb-4bd8-b862-a67934927b38"}'

HTTP response codes.

Response code Case
200 Channel disconnected successfully
404 Channel does not exist
403 Incorrect request signature
400 Invalid data given. Details are available in the request response

Response

This method doesn’t return output.