Add Keywords
curl --request POST \
--url https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords \
--header 'Content-Type: multipart/form-data'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
headers = {"Content-Type": "multipart/form-data"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'Content-Type': 'multipart/form-data'}};
fetch('https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords', 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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Content-Type", "multipart/form-data")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
.header("Content-Type", "multipart/form-data")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'multipart/form-data'
response = http.request(request)
puts response.read_body{
"data": {
"id": "profane-word-list-1",
"name": "profane word list",
"description": "Profane word list",
"category": "word",
"isCSV": true,
"searchTerms": [
"\"a\"",
"\"b\"",
"\"c\""
],
"createdAt": 1720023805,
"updatedAt": 1720023805,
"revisionId": "253179cf5f665257_profane-word-list-1_1",
"active": true
}
}Keywords
Add Keywords
Add keywords or regex patterns to a CometChat moderation list with REST API for automated content checks.
POST
/
moderation
/
keywords
Add Keywords
curl --request POST \
--url https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords \
--header 'Content-Type: multipart/form-data'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
headers = {"Content-Type": "multipart/form-data"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'Content-Type': 'multipart/form-data'}};
fetch('https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords', 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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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://{appId}.api-{region}.cometchat.io/v3/moderation/keywords"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Content-Type", "multipart/form-data")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
.header("Content-Type", "multipart/form-data")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.api-{region}.cometchat.io/v3/moderation/keywords")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'multipart/form-data'
response = http.request(request)
puts response.read_body{
"data": {
"id": "profane-word-list-1",
"name": "profane word list",
"description": "Profane word list",
"category": "word",
"isCSV": true,
"searchTerms": [
"\"a\"",
"\"b\"",
"\"c\""
],
"createdAt": 1720023805,
"updatedAt": 1720023805,
"revisionId": "253179cf5f665257_profane-word-list-1_1",
"active": true
}
}Response
200 - application/json
Created Keyword
Show child attributes
Show child attributes
Was this page helpful?