Rejeitar chamadas recebidas

Endpoint: POST https://croncrm.com/api/v2/chats/reject-incoming-call

Rejeite chamadas recebidas (áudio ou vídeo).

Header do request
Atributo Descrição Obrigatório Tipo

apiKey

Informe sua API Key gerada na interface do CRONCRM.

Sim

String

Body do request
Atributo Descrição Obrigatório Tipo

incoming_call_id

Informe o ID da chamada. Você receberá esse ID via Webhook quando receber uma chamada.

Clique aqui e confira.

Sim

String

{
  "incoming_call_id": "CALL_ID"
}
Response do request

Em caso de sucesso, retorna HTTP 200. Se incoming_call_id não for informado, retorna 422. Se a chamada não for encontrada, retorna 404. Método incorreto retorna 405; falhas inesperadas retornam 500.

Atributo Descrição Tipo

success

Informa se a operação teve sucesso ou não.

Boolean

msg

Mensagem de retorno.

String

{
  "success": true,
  "msg": "Chamada rejeitada com sucesso."
}
<?php
$apiKey = 'SEU_API_KEY';
$url = 'https://croncrm.com/api/v2/chats/reject-incoming-call';

$payload = [
    'incoming_call_id' => 'CALL_ID',
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'apiKey: ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);

if ($error) {
    throw new RuntimeException($error);
}

echo "HTTP {$httpCode}\n";
echo $response;
?>
curl -X POST \
  'https://croncrm.com/api/v2/chats/reject-incoming-call' \
  -H 'apiKey: SEU_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"incoming_call_id":"CALL_ID"}'