curl --request PUT \
--url https://{appid}.api-{region}.cometchat.io/v3/moderation/rules/{ruleId} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"id": "moderation-test",
"name": "Video Moderation",
"enabled": true,
"description": "AI-powered video moderation to detect unsafe content.",
"action": [
"blockMessage"
],
"filters": [
{
"type": "sender",
"entity": "user",
"operand": "uid",
"operator": "equals",
"value": "admin"
}
],
"conditions": [
{
"id": 1,
"entity": "message",
"operand": "image",
"operator": "contains",
"category": "word",
"isKeywordReferencePresent": false,
"isMediaPresent": true,
"value": "violence_greaterThan_30"
}
]
}
'{
"data": {
"id": "moderation-test",
"name": "Video Moderation",
"description": "AI-powered video moderation to detect unsafe content.",
"enabled": true,
"conditions": [
{
"id": 1,
"isKeywordsReferencePresent": false,
"isMediaPresent": true,
"entity": "message",
"operand": "image",
"category": "word",
"operator": "contains",
"value": [
"violence_greaterThan_30"
],
"message": [
"Image contains violence with confidence greater than 30"
]
}
],
"action": [
"blockMessage"
],
"active": true,
"createdAt": 1720003247,
"updatedAt": 1720003247,
"revisionId": "253179cf5f665257_moderation-test_1"
}
}Update an existing moderation rule with new actions or conditions.
curl --request PUT \
--url https://{appid}.api-{region}.cometchat.io/v3/moderation/rules/{ruleId} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"id": "moderation-test",
"name": "Video Moderation",
"enabled": true,
"description": "AI-powered video moderation to detect unsafe content.",
"action": [
"blockMessage"
],
"filters": [
{
"type": "sender",
"entity": "user",
"operand": "uid",
"operator": "equals",
"value": "admin"
}
],
"conditions": [
{
"id": 1,
"entity": "message",
"operand": "image",
"operator": "contains",
"category": "word",
"isKeywordReferencePresent": false,
"isMediaPresent": true,
"value": "violence_greaterThan_30"
}
]
}
'{
"data": {
"id": "moderation-test",
"name": "Video Moderation",
"description": "AI-powered video moderation to detect unsafe content.",
"enabled": true,
"conditions": [
{
"id": 1,
"isKeywordsReferencePresent": false,
"isMediaPresent": true,
"entity": "message",
"operand": "image",
"category": "word",
"operator": "contains",
"value": [
"violence_greaterThan_30"
],
"message": [
"Image contains violence with confidence greater than 30"
]
}
],
"action": [
"blockMessage"
],
"active": true,
"createdAt": 1720003247,
"updatedAt": 1720003247,
"revisionId": "253179cf5f665257_moderation-test_1"
}
}API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
Rule ID
Unique identifier for the moderation rule.
"moderation-test"
Descriptive name for the moderation rule.
"Video Moderation"
Indicates whether the rule is active.
true
Detailed explanation of the rule's purpose.
"AI-powered video moderation to detect unsafe content."
Actions to be taken when a violation is detected.
List of filters to apply
Show child attributes
Type of the filter, specifying sender or receiver
sender, receiver "sender"
Type of entity for user filter
user Field to apply the filter on for 'user'
uid, name, role, tags, createdAt Operator to use for filtering
equals, not equals, in, not in, startsWith "equals"
Value for the filter
"admin"
List of conditions that must be met for the rule to trigger.
Show child attributes
Unique identifier of a condition
1
Entity type in which moderation will be performed.
"message"
Type of message content to moderate (e.g., text, image, video, custom).
text, image, video, custom "image"
Operation to be performed for condition evaluation (e.g., contains, equals).
contains, equals "contains"
Type of entries for evaluation, either 'word' or 'pattern'.
word, pattern "word"
Indicates if the value contains a reference to a keyword list.
false
Indicates if the incoming message contains media content.
true
Actual value for the condition, or reference ID if isKeywordReferencePresent is true, or a formula if isMediaPresent is true.
"violence_greaterThan_30"
Was this page helpful?