POST
/
apps
/
{appId}
/
moderation
/
rules
Add Rule
curl --request POST \
  --url https://apimgmt.cometchat.io/apps/{appId}/moderation/rules \
  --header 'Content-Type: application/json' \
  --header 'key: <key>' \
  --header 'secret: <secret>' \
  --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"
  }
}

Headers

key
string
required

Authorization Key

secret
string
required

Authorization Secret

Path Parameters

appId
string
required

AppID in which the extension has to be enabled/disabled

Body

application/json

Response

200 - application/json

Created Rule

The response is of type object.