curl --request PATCH \
--url https://api.chatling.ai/v3/channels/{channel} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "3132353852",
"ai_replies": false,
"session_timeout_minutes": 60
}
'import requests
url = "https://api.chatling.ai/v3/channels/{channel}"
payload = {
"agent_id": "3132353852",
"ai_replies": False,
"session_timeout_minutes": 60
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: '3132353852', ai_replies: false, session_timeout_minutes: 60})
};
fetch('https://api.chatling.ai/v3/channels/{channel}', 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.chatling.ai/v3/channels/{channel}",
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([
'agent_id' => '3132353852',
'ai_replies' => false,
'session_timeout_minutes' => 60
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.chatling.ai/v3/channels/{channel}"
payload := strings.NewReader("{\n \"agent_id\": \"3132353852\",\n \"ai_replies\": false,\n \"session_timeout_minutes\": 60\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.chatling.ai/v3/channels/{channel}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"3132353852\",\n \"ai_replies\": false,\n \"session_timeout_minutes\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v3/channels/{channel}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"3132353852\",\n \"ai_replies\": false,\n \"session_timeout_minutes\": 60\n}"
response = http.request(request)
puts response.read_body{
"object": "channel",
"channel": "whatsapp",
"agent": {
"id": "3132353852",
"type": "ai_agent",
"name": "Support agent"
},
"status": "not_connected",
"available": true,
"account": {
"name": "Acme Support",
"username": "acme",
"phone_number": "+1 555-010-0100"
},
"disconnected_reason": "token_expired",
"disconnected_at": "2023-11-07T05:31:56Z",
"connected_at": "2023-11-07T05:31:56Z",
"settings": {
"ai_replies": true,
"language": "sq",
"session_timeout_minutes": 123
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_not_connected",
"message": "WhatsApp isn't connected to this agent. Connect it in the dashboard first.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "The name field is required.",
"param": "name",
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw",
"errors": [
{
"param": "name",
"message": "The name field is required."
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}Update a channel's settings
Updates the specified channel’s settings by setting the values of the parameters passed. Any parameters not provided are left unchanged. If any parameter is invalid, nothing is saved.
The channel must be connected. WhatsApp can also be updated while its number is still being registered (setup_incomplete).
curl --request PATCH \
--url https://api.chatling.ai/v3/channels/{channel} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "3132353852",
"ai_replies": false,
"session_timeout_minutes": 60
}
'import requests
url = "https://api.chatling.ai/v3/channels/{channel}"
payload = {
"agent_id": "3132353852",
"ai_replies": False,
"session_timeout_minutes": 60
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: '3132353852', ai_replies: false, session_timeout_minutes: 60})
};
fetch('https://api.chatling.ai/v3/channels/{channel}', 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.chatling.ai/v3/channels/{channel}",
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([
'agent_id' => '3132353852',
'ai_replies' => false,
'session_timeout_minutes' => 60
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.chatling.ai/v3/channels/{channel}"
payload := strings.NewReader("{\n \"agent_id\": \"3132353852\",\n \"ai_replies\": false,\n \"session_timeout_minutes\": 60\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.chatling.ai/v3/channels/{channel}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"3132353852\",\n \"ai_replies\": false,\n \"session_timeout_minutes\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v3/channels/{channel}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"3132353852\",\n \"ai_replies\": false,\n \"session_timeout_minutes\": 60\n}"
response = http.request(request)
puts response.read_body{
"object": "channel",
"channel": "whatsapp",
"agent": {
"id": "3132353852",
"type": "ai_agent",
"name": "Support agent"
},
"status": "not_connected",
"available": true,
"account": {
"name": "Acme Support",
"username": "acme",
"phone_number": "+1 555-010-0100"
},
"disconnected_reason": "token_expired",
"disconnected_at": "2023-11-07T05:31:56Z",
"connected_at": "2023-11-07T05:31:56Z",
"settings": {
"ai_replies": true,
"language": "sq",
"session_timeout_minutes": 123
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_not_connected",
"message": "WhatsApp isn't connected to this agent. Connect it in the dashboard first.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "The name field is required.",
"param": "name",
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw",
"errors": [
{
"param": "name",
"message": "The name field is required."
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}Path Parameters
Body
Unknown parameters return 422.
A language code. Sets the language of the channel's system messages, such as the chat ended notice, error messages, and button labels. The AI's replies follow its own instructions.
sq, ar, hy, az, bn, bs, pt-br, bg, ca, zh-cn, zh-tw, hr, cs, da, nl, en, et, fi, fr, de, el, he, hi, hu, id, it, ja, ko, lv, lt, ms, mn, no, fa, pl, pt, ro, ru, sr, sk, sl, es, sv, th, tr, uk, ur, vi Response
The updated channel.
connected channels receive and send messages. setup_incomplete means WhatsApp is connected but its phone number isn't registered yet. disabled_by_meta means Meta rejected or disabled the WhatsApp account. disabled_by_plan means WhatsApp was turned off because the plan no longer includes it. disconnected means the account was connected before. For Instagram, disconnected_reason says why.
not_connected, connected, setup_incomplete, disabled_by_meta, disabled_by_plan, disconnected