curl --request GET \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey \
--header 'Authorization: Bearer <token>' \
--header 'cloudchat-instance: <cloudchat-instance>'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey"
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'cloudchat-instance': '<cloudchat-instance>', Authorization: 'Bearer <token>'}
};
fetch('https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey', 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}/inboxes/{inboxId}/csat-survey",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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}/inboxes/{inboxId}/csat-survey"
req, _ := http.NewRequest("GET", 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.get("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey")
.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}/inboxes/{inboxId}/csat-survey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 3,
"name": "Support WhatsApp",
"channel_type": "Channel::Whatsapp",
"requires_approval": true,
"format": "full_5",
"language": "pt_BR",
"content": {
"question": "Como foi o atendimento?",
"option_labels": [
"Excelente",
"Bom",
"Regular",
"Ruim",
"Péssimo"
],
"comment_prompt": "Quer contar o motivo?",
"submit_label": "Enviar"
},
"status": "pending",
"provisioning_error": null
}{
"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": "This account is suspended."
}
}{
"error": {
"code": "not_found",
"message": "Resource could not be found."
}
}{
"error": {
"code": "validation_failed",
"message": "This inbox does not support the satisfaction survey. Only WhatsApp Cloud, web widget and email inboxes do.",
"details": [
{
"field": "inbox_id",
"code": "unsupported_channel",
"message": "This inbox does not support the satisfaction survey. Only WhatsApp Cloud, web widget and email inboxes do."
}
]
}
}{
"message": "API rate limit exceeded"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}
}Get the satisfaction survey of an inbox
Administrator only. The satisfaction (CSAT) survey the inbox sends when a conversation is resolved: language, scale and the texts. content.option_labels lists the five rating labels from the best rating (5) to the worst (1). On a WhatsApp Cloud inbox the survey is a message template Meta has to approve, and status follows that approval. Whether the survey is sent at all is the csat_survey_enabled field of the inbox. Only WhatsApp Cloud, web widget and email inboxes carry a satisfaction survey. Any other inbox answers 422 with code unsupported_channel.
curl --request GET \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey \
--header 'Authorization: Bearer <token>' \
--header 'cloudchat-instance: <cloudchat-instance>'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey"
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'cloudchat-instance': '<cloudchat-instance>', Authorization: 'Bearer <token>'}
};
fetch('https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey', 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}/inboxes/{inboxId}/csat-survey",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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}/inboxes/{inboxId}/csat-survey"
req, _ := http.NewRequest("GET", 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.get("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey")
.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}/inboxes/{inboxId}/csat-survey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 3,
"name": "Support WhatsApp",
"channel_type": "Channel::Whatsapp",
"requires_approval": true,
"format": "full_5",
"language": "pt_BR",
"content": {
"question": "Como foi o atendimento?",
"option_labels": [
"Excelente",
"Bom",
"Regular",
"Ruim",
"Péssimo"
],
"comment_prompt": "Quer contar o motivo?",
"submit_label": "Enviar"
},
"status": "pending",
"provisioning_error": null
}{
"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": "This account is suspended."
}
}{
"error": {
"code": "not_found",
"message": "Resource could not be found."
}
}{
"error": {
"code": "validation_failed",
"message": "This inbox does not support the satisfaction survey. Only WhatsApp Cloud, web widget and email inboxes do.",
"details": [
{
"field": "inbox_id",
"code": "unsupported_channel",
"message": "This inbox does not support the satisfaction survey. Only WhatsApp Cloud, web widget and email inboxes do."
}
]
}
}{
"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
Response
The satisfaction survey of the inbox.
The satisfaction survey of one inbox.
unconfigured: no survey yet. ready: web widget and email, the survey is live. not_created: WhatsApp, the template was not submitted yet. pending: Meta is reviewing it. approved: it is delivered. rejected: Meta refused it. failed: the submission to Meta failed, see provisioning_error.
unconfigured, ready, not_created, pending, approved, rejected, failed "pending"