curl --request POST \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute \
--header 'Authorization: Bearer <token>' \
--header 'cloudchat-instance: <cloudchat-instance>'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute"
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'cloudchat-instance': '<cloudchat-instance>', Authorization: 'Bearer <token>'}
};
fetch('https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"cloudchat-instance: <cloudchat-instance>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"conversation_id": 1042,
"muted": true,
"status": "resolved",
"contact": {
"id": 815,
"name": "Jane"
},
"inbox": {
"id": 3,
"name": "WhatsApp"
}
}{
"error": {
"code": "bad_request",
"message": "The request is malformed."
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication is required. Send a valid Bearer token in the Authorization header."
}
}{
"error": {
"code": "forbidden",
"message": "Your role in this account is not allowed to block or unblock contacts. Account administrators choose which roles can, in the account setting \"Roles allowed to block contacts\": ask one of them to allow your role, or to run this request."
}
}{
"error": {
"code": "not_found",
"message": "Resource could not be found."
}
}{
"error": {
"code": "conflict",
"message": "The request conflicts with the current state of the resource.",
"details": [
{
"field": "conversation",
"code": "blocked_by_bounce",
"message": "The contact's email already bounced on this inbox, so the contact is already blocked by the system and there is nothing to block."
}
]
}
}{
"message": "API rate limit exceeded"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}
}Block the contact of a conversation
Block the customer of a conversation on the inbox it lives in — the Block contact button of the dashboard.
What happens:
- The conversation is resolved right away, with the same events as any resolution. As with the dashboard, resolving can make Cloud Chat send the customer the satisfaction survey when the inbox has it enabled, and that message cannot be taken back.
- The customer is marked as blocked on that inbox. The block covers every conversation they have there and none they have on another inbox.
- While it lasts, the customer’s messages are still received and kept, but they no longer reopen a conversation. On every inbox type except the website widget, a new conversation the customer starts is created already resolved, so nothing reaches the team’s queue. On a website widget inbox a new conversation still opens normally, and the customer stops receiving the email copy of agent replies.
- It is a Cloud Chat setting only: the customer is not told, and nothing is blocked at the channel provider (WhatsApp, Instagram and so on). An activity line in the conversation records who blocked the contact.
Blocking is idempotent: when the customer is already blocked on the inbox, the call answers 200 with the current state and changes nothing. Lift the block with Unblock the contact of a conversation.
Which roles may block is chosen per account by its administrators in the account setting Roles allowed to block contacts. By default every role except Assistant can; a role without the permission gets a 403 and nothing changes. A customer whose email already bounced on the inbox is already blocked by the system and answers 409, and so does a conversation mirrored from another helpdesk, which is read-only here.
The response reads the state back after the write: muted, the conversation status, and the contact and inbox the block applies to. Visibility follows the same rule as the list: an administrator token reaches every inbox of the account, an agent token only its own inbox memberships. A conversation outside that reach answers 404, indistinguishable from an id that does not exist.
curl --request POST \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute \
--header 'Authorization: Bearer <token>' \
--header 'cloudchat-instance: <cloudchat-instance>'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute"
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'cloudchat-instance': '<cloudchat-instance>', Authorization: 'Bearer <token>'}
};
fetch('https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"cloudchat-instance: <cloudchat-instance>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/conversations/{conversationId}/mute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"conversation_id": 1042,
"muted": true,
"status": "resolved",
"contact": {
"id": 815,
"name": "Jane"
},
"inbox": {
"id": 3,
"name": "WhatsApp"
}
}{
"error": {
"code": "bad_request",
"message": "The request is malformed."
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication is required. Send a valid Bearer token in the Authorization header."
}
}{
"error": {
"code": "forbidden",
"message": "Your role in this account is not allowed to block or unblock contacts. Account administrators choose which roles can, in the account setting \"Roles allowed to block contacts\": ask one of them to allow your role, or to run this request."
}
}{
"error": {
"code": "not_found",
"message": "Resource could not be found."
}
}{
"error": {
"code": "conflict",
"message": "The request conflicts with the current state of the resource.",
"details": [
{
"field": "conversation",
"code": "blocked_by_bounce",
"message": "The contact's email already bounced on this inbox, so the contact is already blocked by the system and there is nothing to block."
}
]
}
}{
"message": "API rate limit exceeded"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}
}Authorizations
Headers
Your Cloud Chat instance ID — an integer, fixed for your company, told at onboarding. The API overview explains how instances work, how to find yours, and the errors a wrong or missing value produces.
1
Path Parameters
Your Cloud Chat account. It has to be an account your token grants membership on, and it has to live on the instance in the cloudchat-instance header — the two travel together. Account numbers are only unique within an instance, so the same number is a different company on another instance. Usually a mismatched pair fails closed with a 401, because your user does not exist on the other instance — but if your identity happens to exist on both, the call succeeds against the other company's data, silently. Read it and you are looking at the wrong help center; write it and you have stored into the wrong account. Send the two values that were given to you together, and never try a number to see what answers.
1
The conversation's display_id — the number shown in the dashboard URL and delivered in webhooks. It is never the internal database id, and it is never the conversation's uuid: when all you have is a uuid or a helpdesk ticket id, resolve it to a display_id with Find a conversation first.
1042
Response
The state after the call: muted: true, the conversation status and the contact and inbox the block applies to. The same answer, with nothing written, when the customer was already blocked.
What a block or unblock left behind, read back after the write so it can be confirmed.