curl --request PATCH \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'cloudchat-instance: <cloudchat-instance>' \
--data '
{
"csat_survey": {
"language": "pt_BR",
"format": "full_5",
"content": {
"question": "Como foi o atendimento?",
"option_labels": [
"Excelente",
"Bom",
"Regular",
"Ruim",
"Péssimo"
],
"comment_prompt": "Quer contar o motivo?",
"submit_label": "Enviar"
}
}
}
'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey"
payload = { "csat_survey": {
"language": "pt_BR",
"format": "full_5",
"content": {
"question": "Como foi o atendimento?",
"option_labels": ["Excelente", "Bom", "Regular", "Ruim", "Péssimo"],
"comment_prompt": "Quer contar o motivo?",
"submit_label": "Enviar"
}
} }
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'cloudchat-instance': '<cloudchat-instance>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
csat_survey: {
language: 'pt_BR',
format: 'full_5',
content: {
question: 'Como foi o atendimento?',
option_labels: ['Excelente', 'Bom', 'Regular', 'Ruim', 'Péssimo'],
comment_prompt: 'Quer contar o motivo?',
submit_label: 'Enviar'
}
}
})
};
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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'csat_survey' => [
'language' => 'pt_BR',
'format' => 'full_5',
'content' => [
'question' => 'Como foi o atendimento?',
'option_labels' => [
'Excelente',
'Bom',
'Regular',
'Ruim',
'Péssimo'
],
'comment_prompt' => 'Quer contar o motivo?',
'submit_label' => 'Enviar'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey"
payload := strings.NewReader("{\n \"csat_survey\": {\n \"language\": \"pt_BR\",\n \"format\": \"full_5\",\n \"content\": {\n \"question\": \"Como foi o atendimento?\",\n \"option_labels\": [\n \"Excelente\",\n \"Bom\",\n \"Regular\",\n \"Ruim\",\n \"Péssimo\"\n ],\n \"comment_prompt\": \"Quer contar o motivo?\",\n \"submit_label\": \"Enviar\"\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"csat_survey\": {\n \"language\": \"pt_BR\",\n \"format\": \"full_5\",\n \"content\": {\n \"question\": \"Como foi o atendimento?\",\n \"option_labels\": [\n \"Excelente\",\n \"Bom\",\n \"Regular\",\n \"Ruim\",\n \"Péssimo\"\n ],\n \"comment_prompt\": \"Quer contar o motivo?\",\n \"submit_label\": \"Enviar\"\n }\n }\n}")
.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::Patch.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"csat_survey\": {\n \"language\": \"pt_BR\",\n \"format\": \"full_5\",\n \"content\": {\n \"question\": \"Como foi o atendimento?\",\n \"option_labels\": [\n \"Excelente\",\n \"Bom\",\n \"Regular\",\n \"Ruim\",\n \"Péssimo\"\n ],\n \"comment_prompt\": \"Quer contar o motivo?\",\n \"submit_label\": \"Enviar\"\n }\n }\n}"
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.",
"details": [
{
"field": "csat_survey",
"code": "empty",
"message": "Provide at least one of language, format or content inside csat_survey."
}
]
}
}{
"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": "The request payload is invalid.",
"details": [
{
"field": "language",
"code": "invalid",
"message": "The language must be one of: en, es, pt_BR."
}
]
}
}{
"message": "API rate limit exceeded"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}
}Update the satisfaction survey of an inbox
Administrator only. Changes the language, the scale or the texts of the survey and answers with the survey as stored, read back. What is not sent stays untouched, including content keys you leave out. An object with none of language, format and content is a 400. An inbox with no survey yet needs format together with language and a complete content. A field or content key outside the writable ones is refused with 422 and code not_editable. On a WhatsApp Cloud inbox, saving with a language makes CloudChat publish the survey form and submit the message template for that language to Meta, unless it already exists there. Meta reviews it asynchronously, so the response can still say pending, and the survey is delivered only once status is approved. Only WhatsApp Cloud, web widget and email inboxes carry a satisfaction survey. Any other inbox answers 422 with code unsupported_channel.
curl --request PATCH \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'cloudchat-instance: <cloudchat-instance>' \
--data '
{
"csat_survey": {
"language": "pt_BR",
"format": "full_5",
"content": {
"question": "Como foi o atendimento?",
"option_labels": [
"Excelente",
"Bom",
"Regular",
"Ruim",
"Péssimo"
],
"comment_prompt": "Quer contar o motivo?",
"submit_label": "Enviar"
}
}
}
'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey"
payload = { "csat_survey": {
"language": "pt_BR",
"format": "full_5",
"content": {
"question": "Como foi o atendimento?",
"option_labels": ["Excelente", "Bom", "Regular", "Ruim", "Péssimo"],
"comment_prompt": "Quer contar o motivo?",
"submit_label": "Enviar"
}
} }
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'cloudchat-instance': '<cloudchat-instance>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
csat_survey: {
language: 'pt_BR',
format: 'full_5',
content: {
question: 'Como foi o atendimento?',
option_labels: ['Excelente', 'Bom', 'Regular', 'Ruim', 'Péssimo'],
comment_prompt: 'Quer contar o motivo?',
submit_label: 'Enviar'
}
}
})
};
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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'csat_survey' => [
'language' => 'pt_BR',
'format' => 'full_5',
'content' => [
'question' => 'Como foi o atendimento?',
'option_labels' => [
'Excelente',
'Bom',
'Regular',
'Ruim',
'Péssimo'
],
'comment_prompt' => 'Quer contar o motivo?',
'submit_label' => 'Enviar'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey"
payload := strings.NewReader("{\n \"csat_survey\": {\n \"language\": \"pt_BR\",\n \"format\": \"full_5\",\n \"content\": {\n \"question\": \"Como foi o atendimento?\",\n \"option_labels\": [\n \"Excelente\",\n \"Bom\",\n \"Regular\",\n \"Ruim\",\n \"Péssimo\"\n ],\n \"comment_prompt\": \"Quer contar o motivo?\",\n \"submit_label\": \"Enviar\"\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/csat-survey")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"csat_survey\": {\n \"language\": \"pt_BR\",\n \"format\": \"full_5\",\n \"content\": {\n \"question\": \"Como foi o atendimento?\",\n \"option_labels\": [\n \"Excelente\",\n \"Bom\",\n \"Regular\",\n \"Ruim\",\n \"Péssimo\"\n ],\n \"comment_prompt\": \"Quer contar o motivo?\",\n \"submit_label\": \"Enviar\"\n }\n }\n}")
.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::Patch.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"csat_survey\": {\n \"language\": \"pt_BR\",\n \"format\": \"full_5\",\n \"content\": {\n \"question\": \"Como foi o atendimento?\",\n \"option_labels\": [\n \"Excelente\",\n \"Bom\",\n \"Regular\",\n \"Ruim\",\n \"Péssimo\"\n ],\n \"comment_prompt\": \"Quer contar o motivo?\",\n \"submit_label\": \"Enviar\"\n }\n }\n}"
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.",
"details": [
{
"field": "csat_survey",
"code": "empty",
"message": "Provide at least one of language, format or content inside csat_survey."
}
]
}
}{
"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": "The request payload is invalid.",
"details": [
{
"field": "language",
"code": "invalid",
"message": "The language must be one of: en, es, pt_BR."
}
]
}
}{
"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
Body
Response
The satisfaction survey after the update.
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"