diff --git a/chat-apis.json b/chat-apis.json index 0ccb95896..17dc9cd86 100644 --- a/chat-apis.json +++ b/chat-apis.json @@ -12949,6 +12949,2055 @@ } ] } + }, + "/moderation/reasons": { + "post": { + "operationId": "create-reason", + "summary": "Create Reasons", + "description": "Creates a new moderation reason in the app. This reason can then be selected by end users when flagging a message they find inappropriate.", + "tags": [ + "Moderation - Reasons" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the content type.", + "example": "unfiltered-content" + }, + "name": { + "type": "string", + "description": "Display name for the content type.", + "example": "RawContent" + }, + "description": { + "type": "string", + "description": "Description of the content type.", + "example": "Content delivered without moderation or filtering." + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Reason created successfully.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "unfiltered-content" + }, + "name": { + "type": "string", + "example": "RawContent" + }, + "description": { + "type": "string", + "example": "Content delivered without moderation or filtering." + }, + "createdAt": { + "type": "integer", + "example": 1760449410 + }, + "updatedAt": { + "type": "integer", + "example": 1760449410 + } + } + } + } + } + } + } + } + } + }, + "get": { + "operationId": "list-reasons", + "summary": "List Reasons", + "description": "Lists all moderation reasons configured in the app.", + "tags": [ + "Moderation - Reasons" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + } + ], + "responses": { + "200": { + "description": "List of moderation reasons.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "default": { + "type": "boolean" + } + } + } + }, + "meta": { + "type": "object", + "properties": { + "current": { + "type": "object", + "properties": { + "limit": { + "type": "integer" + }, + "count": { + "type": "integer" + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/moderation/reasons/{id}": { + "get": { + "operationId": "get-reason-details", + "summary": "Get Reason details", + "description": "Retrieves detailed information about a specific moderation reason configured in the app.", + "tags": [ + "Moderation - Reasons" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Id of the reason which needs to be fetched." + } + ], + "responses": { + "200": { + "description": "Reason details.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "put": { + "operationId": "update-reason-details", + "summary": "Update Reason details", + "description": "Updates the details of an existing moderation reason.", + "tags": [ + "Moderation - Reasons" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Id of the reason which needs to be updated." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Updated display name for the content type.", + "example": "Updated name for unfiltered content." + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Reason updated successfully.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "delete-reason", + "summary": "Delete Reasons", + "description": "Deletes moderation reasons from the app configuration.", + "tags": [ + "Moderation - Reasons" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Id of the reason which needs to be deleted." + } + ], + "responses": { + "200": { + "description": "Reason deleted successfully.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "The reason with id spam has been deleted successfully." + } + } + } + } + } + } + } + } + }, + "/messages/{id}/flagged": { + "post": { + "operationId": "flag-a-message", + "summary": "Flag a message", + "description": "Flags a specific message for moderation review. The flagged message is presented to a moderator for evaluation, who can then decide to either block the message or approve it based on the review outcome.", + "tags": [ + "Moderation - Flagged Messages" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Id of the message to be flagged." + }, + { + "name": "onBehalfOf", + "in": "header", + "required": true, + "schema": { + "type": "string" + }, + "description": "UID of the user on whose behalf the action is performed." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "reasonId": { + "type": "string", + "description": "Unique identifier of the moderation reason used to flag the message." + }, + "remark": { + "type": "string", + "description": "Additional remark or comment about why the message is being flagged." + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Message flagged successfully.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + } + } + } + } + } + }, + "/moderation/flagged-messages": { + "get": { + "operationId": "list-flagged-messages", + "summary": "List flagged messages", + "description": "Lists all messages that have been flagged for moderation review.", + "tags": [ + "Moderation - Flagged Messages" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + } + ], + "responses": { + "200": { + "description": "List of flagged messages.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object" + } + }, + "meta": { + "type": "object", + "properties": { + "current": { + "type": "object", + "properties": { + "limit": { + "type": "integer" + }, + "count": { + "type": "integer" + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/moderation/flagged-messages/{id}": { + "patch": { + "operationId": "blockreview-flagged-message", + "summary": "Block/Review Flagged Message", + "description": "Enables moderators to review flagged messages and take action by either approving acceptable content or blocking policy violations, automatically transferring flagged messages to the reviewed list for tracking purposes.", + "tags": [ + "Moderation - Flagged Messages" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Id of the message which needs to be reviewed." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "Specifies the moderation action to apply to the flagged message.", + "enum": [ + "approved", + "disapproved" + ] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Flagged message reviewed successfully.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + } + } + } + } + } + }, + "/moderation/reviewed-messages": { + "get": { + "operationId": "list-reviewed-messages", + "summary": "List Reviewed messages", + "description": "Lists all messages that have been reviewed by moderators.", + "tags": [ + "Moderation - Reviewed Messages" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + } + ], + "responses": { + "200": { + "description": "List of reviewed messages.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object" + } + }, + "meta": { + "type": "object", + "properties": { + "current": { + "type": "object", + "properties": { + "limit": { + "type": "integer" + }, + "count": { + "type": "integer" + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/moderation/blocked-messages/{id}": { + "patch": { + "operationId": "review-blocked-message", + "summary": "Review Blocked Message", + "description": "Updates the review status of a previously blocked message. This endpoint allows approving or rejecting the message based on the moderation evaluation results.", + "tags": [ + "Moderation - Blocked Messages" + ], + "parameters": [ + { + "$ref": "#/components/parameters/apikey" + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Id of the blocked message to review." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "Indicates the review decision for the moderated message.", + "enum": [ + "approved", + "rejected" + ] + }, + "reviewed": { + "type": "boolean", + "description": "Specifies whether the moderation request has been reviewed." + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Blocked message reviewed successfully.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "Message with ID 540185 has been reviewed successfully." + } + } + } + } + } + } + } + } + } + } + }, + "/moderation/rules": { + "post": { + "tags": [ + "Moderation" + ], + "summary": "Add Rule", + "description": "Create a new moderation rule to specify actions and conditions for detecting and handling inappropriate content.", + "operationId": "create-rule", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ModerationRequestBody" + } + } + } + }, + "responses": { + "200": { + "description": "Created Rule", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/ModerationData" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "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" + } + } + } + } + } + } + }, + "get": { + "tags": [ + "Moderation" + ], + "summary": "List Rules", + "description": "Retrieve a list of all moderation rules.", + "operationId": "list-rules", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + }, + { + "name": "limit", + "in": "query", + "description": "The number of records to fetch.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "List Rule", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + }, + "meta": { + "properties": { + "": { + "$ref": "#/components/schemas/metaSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "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" + }, + { + "id": "video-moderation1", + "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": 1720000488, + "updatedAt": 1720000488, + "revisionId": "253179cf5f665257_video-moderation1_1" + }, + { + "id": "text-profanity-filter", + "name": "Text Profanity filter", + "description": "Detect and censor profanity in text messages.", + "enabled": true, + "conditions": [ + { + "id": 1, + "isKeywordsReferencePresent": true, + "isMediaPresent": false, + "entity": "message", + "operand": "text", + "category": "word", + "operator": "contains", + "value": [ + "profanity-list" + ] + } + ], + "action": [ + "blockMessage" + ], + "active": true, + "createdAt": 1718355386, + "updatedAt": 1720006272, + "revisionId": "253157108b5294c4_profanity-filter_25", + "default": true + }, + { + "id": "image-moderation", + "name": "AI Image Moderation", + "description": "AI-powered image moderation to detect unsafe content.", + "enabled": false, + "conditions": [ + { + "id": 1, + "isKeywordsReferencePresent": false, + "isMediaPresent": true, + "entity": "message", + "operand": "image", + "category": "word", + "operator": "contains", + "value": [ + "AnyOf_greaterThan_30" + ] + } + ], + "action": [ + "blockMessage" + ], + "active": true, + "createdAt": 1718350200, + "updatedAt": 1719932600, + "revisionId": "253157108b5294c4_image-moderation_11", + "default": true + }, + { + "id": "video-moderation", + "name": "AI Video Moderation", + "description": "AI-powered video moderation to detect unsafe content.", + "enabled": false, + "conditions": [ + { + "id": 1, + "isKeywordsReferencePresent": false, + "isMediaPresent": true, + "entity": "message", + "operand": "video", + "category": "word", + "operator": "contains", + "value": [ + "AnyOf_greaterThan_30" + ] + } + ], + "action": [ + "dropMessage" + ], + "active": true, + "createdAt": 1718350199, + "updatedAt": 1720006008, + "revisionId": "253157108b5294c4_video-moderation_10", + "default": true + }, + { + "id": "custom-profanity-filter", + "name": "Custom Profanity filter", + "description": "Detect and censor profanity in custom messages.", + "enabled": false, + "conditions": [ + { + "id": 1, + "isListReferencePresent": true, + "isMediaPresent": false, + "entity": "message", + "operand": "custom", + "category": "word", + "operator": "contains", + "value": [ + "profanity-list" + ] + } + ], + "action": [ + "dropMessage" + ], + "active": true, + "createdAt": 1718341200, + "updatedAt": 1719819136, + "revisionId": "253157108b5294c4_profanity-filter_8", + "default": true + }, + { + "id": "contact_details_filter", + "name": "Contact details filter", + "description": "Identifies and removes phone numbers from text", + "enabled": false, + "conditions": [ + { + "id": 1, + "isKeywordsReferencePresent": false, + "isMediaPresent": false, + "entity": "message", + "operand": "text", + "category": "pattern", + "operator": "contains", + "value": [ + "\\\\+?(\\\\d{1,3})?{-.\\\\s}?\\\\(?\\\\d{1,4}?\\\\)?{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,9}" + ] + }, + { + "id": 2, + "isKeywordsReferencePresent": false, + "isMediaPresent": false, + "entity": "message", + "operand": "custom", + "category": "pattern", + "operator": "contains", + "value": [ + "\\\\+?(\\\\d{1,3})?{-.\\\\s}?\\\\(?\\\\d{1,4}?\\\\)?{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,9}" + ] + } + ], + "action": [ + "blockMessage" + ], + "active": true, + "createdAt": 1718186338, + "updatedAt": 1719836048, + "revisionId": "2531882e5e289115_contact_details_filter_3", + "default": true + }, + { + "id": "email_filter", + "name": "Email filter", + "description": "Identify and remove email address from messages", + "enabled": false, + "conditions": [ + { + "id": 1, + "isKeywordsReferencePresent": false, + "isMediaPresent": false, + "entity": "message", + "operand": "text", + "category": "pattern", + "operator": "contains", + "value": [ + "^{a-zA-Z0-9._%+-}+@{a-zA-Z0-9.-}+\\\\.{a-zA-Z}{2,}$" + ] + }, + { + "id": 2, + "isKeywordsReferencePresent": false, + "isMediaPresent": false, + "entity": "message", + "operand": "custom", + "category": "pattern", + "operator": "contains", + "value": [ + "^{a-zA-Z0-9._%+-}+@{a-zA-Z0-9.-}+\\\\.{a-zA-Z}{2,}$" + ] + } + ], + "action": [ + "blockMessage" + ], + "active": true, + "createdAt": 1718099938, + "updatedAt": 1719836049, + "revisionId": "2531882e5e289115_contact_email_filter_5", + "default": true + } + ], + "meta": { + "current": { + "limit": 50, + "count": 8 + } + } + } + } + } + } + } + } + }, + "/moderation/rules/{ruleId}": { + "get": { + "tags": [ + "Moderation" + ], + "summary": "Get Rule", + "description": "Retrieve details of a specific moderation rule by its ID.", + "operationId": "get-rule", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + }, + { + "$ref": "#/components/parameters/ruleId" + } + ], + "responses": { + "200": { + "description": "Get Rule", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": { + "id": "profanity-list", + "name": "Profane Words", + "category": "word", + "isCSV": false, + "searchTerms": [ + "fuck", + "damn", + "shit", + "cunt", + "nigga", + "nigger", + "wanker", + "cunt", + "fag", + "shithead", + "jizz", + "hellbitch", + "retard", + "cocksucker", + "cock", + "kill", + "kike", + "twat", + "bastard", + "death", + "asshole", + "wop", + "scumbag", + "penis", + "murder", + "dick", + "gook", + "vagina", + "rape", + "bastard", + "spic", + "spunk", + "beat" + ], + "createdAt": 1718354412, + "updatedAt": 1718354412, + "revisionId": "253157108b5294c4_profanity-list_1", + "active": true, + "default": true + } + } + } + } + } + } + }, + "put": { + "tags": [ + "Moderation" + ], + "summary": "Update Rule", + "description": "Update an existing moderation rule with new actions or conditions.", + "operationId": "update-rule", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + }, + { + "$ref": "#/components/parameters/ruleId" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ModerationRequestBody" + } + } + } + }, + "responses": { + "200": { + "description": "Update Rule", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "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" + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "Moderation" + ], + "summary": "Remove rule", + "description": "Delete a specific moderation rule by its ID.", + "operationId": "delete-rule", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + }, + { + "$ref": "#/components/parameters/ruleId" + } + ], + "responses": { + "200": { + "description": "Delete Rule", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": { + "success": true, + "message": "Rule with id moderation-test has been deleted successfully." + } + } + } + } + } + } + } + }, + "/moderation/keywords": { + "post": { + "tags": [ + "Moderation" + ], + "summary": "Add Keywords", + "description": "Create a new keyword list for moderation.", + "operationId": "create-rule-keyword", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/KeywordList" + } + } + } + }, + "responses": { + "200": { + "description": "Created Keyword", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "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 + } + } + } + } + } + } + }, + "get": { + "tags": [ + "Moderation" + ], + "summary": "List keywords", + "description": "Fetches all the keywords.", + "operationId": "list-rule-keywords", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + } + ], + "responses": { + "200": { + "description": "List Keywords", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + }, + "meta": { + "properties": { + "": { + "$ref": "#/components/schemas/metaSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": [ + { + "_id": "66857afdb4bf371ddfba853b", + "id": "profane-word-list-1", + "appId": "253179cf5f665257", + "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, + "__v": 0 + }, + { + "_id": "666c01eccfe97336757fb611", + "id": "profanity-list", + "name": "Profane Words", + "category": "word", + "isCSV": false, + "searchTerms": [ + "fuck", + "nigger", + "fuck", + "nigger", + "wanker", + "cunt", + "damn", + "shit", + "fag", + "shithead", + "jizz", + "hellbitch", + "retard", + "cocksucker", + "cock", + "kill", + "cunt", + "kike", + "twat", + "bastard", + "death", + "asshole", + "wop", + "scumbag", + "penis", + "murder", + "dick", + "gook", + "vagina", + "rape", + "bastard", + "spic", + "spunk", + "beat" + ], + "createdAt": 1718354412, + "updatedAt": 1718354412, + "revisionId": "253157108b5294c4_profanity-list_1", + "active": true, + "__v": 0, + "default": true, + "appId": "default" + } + ], + "meta": { + "current": { + "limit": 10, + "count": 2 + } + } + } + } + } + } + } + } + }, + "/moderation/keywords/{keywordId}": { + "get": { + "tags": [ + "Moderation" + ], + "summary": "Get keyword", + "description": "Retrieve details of a specific keyword list by its ID.", + "operationId": "get-rule-keyword", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/keywordId" + }, + { + "$ref": "#/components/parameters/appId" + } + ], + "responses": { + "200": { + "description": "Get Keyword", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": { + "id": "profanity-list", + "name": "Profane Words", + "category": "word", + "isCSV": false, + "searchTerms": [ + "fuck", + "nigger", + "fuck", + "nigger", + "wanker", + "cunt", + "damn", + "shit", + "fag", + "shithead", + "jizz", + "hellbitch", + "retard", + "cocksucker", + "cock", + "kill", + "cunt", + "kike", + "twat", + "bastard", + "death", + "asshole", + "wop", + "scumbag", + "penis", + "murder", + "dick", + "gook", + "vagina", + "rape", + "bastard", + "spic", + "spunk", + "beat" + ], + "createdAt": 1718354412, + "updatedAt": 1718354412, + "revisionId": "253157108b5294c4_profanity-list_1", + "active": true, + "default": true + } + } + } + } + } + } + }, + "put": { + "tags": [ + "Moderation" + ], + "summary": "Update keyword", + "description": "Update an existing keyword list.", + "operationId": "update-rule-keyword", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/keywordId" + }, + { + "$ref": "#/components/parameters/appId" + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/KeywordList" + } + } + } + }, + "responses": { + "200": { + "description": "Update Keyword", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": { + "id": "profanity-list", + "name": "Profane Words", + "category": "word", + "isCSV": false, + "searchTerms": [ + "fuck", + "nigger", + "fuck", + "nigger", + "wanker", + "cunt", + "damn", + "shit", + "fag", + "shithead", + "jizz", + "hellbitch", + "retard", + "cocksucker", + "cock", + "kill", + "cunt", + "kike", + "twat", + "bastard", + "death", + "asshole", + "wop", + "scumbag", + "penis", + "murder", + "dick", + "gook", + "vagina", + "rape", + "bastard", + "spic", + "spunk", + "beat" + ], + "createdAt": 1718354412, + "updatedAt": 1718354412, + "revisionId": "253157108b5294c4_profanity-list_1", + "active": true, + "default": true + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "Moderation" + ], + "summary": "Remove keyword", + "description": "Delete a keyword list by its ID.", + "operationId": "delete-rule-keyword", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/keywordId" + }, + { + "$ref": "#/components/parameters/appId" + } + ], + "responses": { + "200": { + "description": "Delete Keyword", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": { + "success": true, + "message": "Keyword with id profanity-list has been deleted successfully." + } + } + } + } + } + } + } + }, + "/moderation/rules/{ruleId}/revisions": { + "get": { + "tags": [ + "Moderation" + ], + "summary": "Get Rule Revisions", + "description": "Fetches a rule's revisions.", + "operationId": "list-rule-revisions", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + }, + { + "$ref": "#/components/parameters/ruleId" + } + ], + "responses": { + "200": { + "description": "List Rule revisions", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + }, + "meta": { + "properties": { + "": { + "$ref": "#/components/schemas/metaSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": [ + { + "id": "moderation-test", + "name": "Video Moderation", + "description": "AI-powered video moderation to detect unsafe content.", + "enabled": true, + "conditions": [ + { + "id": 1, + "isKeywordsReferencePresent": false, + "isMediaPresent": false, + "entity": "message", + "operand": "text", + "category": "word", + "operator": "equals", + "value": [ + "paris" + ] + } + ], + "action": [ + "blockMessage" + ], + "active": true, + "createdAt": 1720011899, + "updatedAt": 1720011905, + "revisionId": "253179cf5f665257_moderation-test_2" + }, + { + "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": false, + "createdAt": 1720011899, + "updatedAt": 1720011899, + "revisionId": "253179cf5f665257_moderation-test_1" + } + ], + "meta": { + "current": { + "limit": 10, + "count": 2 + } + } + } + } + } + } + } + } + }, + "/moderation/blocked-messages": { + "get": { + "tags": [ + "Moderation" + ], + "summary": "List Blocked Messages", + "description": "Lists the messages blocked by the moderation service.", + "operationId": "list-moderation-blocked-messages", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + } + ], + "responses": { + "200": { + "description": "List Blocked Messages", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + }, + "meta": { + "properties": { + "": { + "$ref": "#/components/schemas/metaSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": [ + { + "ruleId": "image-moderation", + "ruleName": "AI Image Moderation", + "revisionId": "253156be20433c97_image-moderation_4", + "condition": { + "id": 1, + "isKeywordsReferencePresent": false, + "isMediaPresent": true, + "entity": "message", + "operand": "image", + "category": "word", + "operator": "contains", + "value": [ + "Any unsafe content_greaterThan_70" + ], + "message": [ + "Image contains Any unsafe content with confidence greater than 70" + ], + "weight": 1 + }, + "message": { + "id": "65", + "muid": "_5zytzmceo", + "conversationId": "cometchat-uid-1_user_cometchat-uid-2", + "sender": "cometchat-uid-1", + "receiverType": "user", + "receiver": "cometchat-uid-2", + "category": "message", + "type": "image", + "data": { + "metadata": { + "file": [] + }, + "resource": "WEB-4_0_3-ffa565b2-476e-493d-aeb5-4c750aae3ab1-1719925738505", + "url": "https://data-eu.cometchat.io/2601293c931567f7/media/1719993037_336554568_9e044ea0ed5817381b189680f392bafe.jpeg", + "attachments": [ + { + "name": "download.jpeg", + "extension": "jpeg", + "size": 4761, + "mimeType": "image/jpeg", + "url": "https://data-eu.cometchat.io/2601293c931567f7/media/1719993037_336554568_9e044ea0ed5817381b189680f392bafe.jpeg" + } + ], + "entities": { + "sender": { + "entity": { + "uid": "cometchat-uid-1", + "name": "Andrew Joseph", + "avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp", + "status": "offline", + "role": "default" + }, + "entityType": "user" + }, + "receiver": { + "entity": { + "uid": "cometchat-uid-2", + "name": "George Alan", + "avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp", + "status": "offline", + "role": "default", + "conversationId": "cometchat-uid-1_user_cometchat-uid-2" + }, + "entityType": "user" + } + }, + "moderation": { + "status": "pending" + } + }, + "sentAt": 1719993037, + "updatedAt": 1719993037 + }, + "action": [ + "blockMessage" + ], + "createdAt": 1719993038, + "updatedAt": 1719993038 + } + ], + "meta": { + "current": { + "limit": 50, + "count": 20 + } + } + } + } + } + } + } + } + }, + "/moderation/blocked-messages/{messageId}": { + "patch": { + "tags": [ + "Moderation" + ], + "summary": "Approve Blocked Messages", + "description": "Approves the messages blocked by the moderation service.", + "operationId": "approve-moderation-blocked-messages", + "parameters": [ + { + "$ref": "#/components/parameters/key" + }, + { + "$ref": "#/components/parameters/secret" + }, + { + "$ref": "#/components/parameters/appId" + }, + { + "$ref": "#/components/parameters/messageId" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "status" + ], + "properties": { + "status": { + "description": "Moderation status of the message.", + "type": "string", + "example": "approved" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Approve Blocked Messages", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "": { + "$ref": "#/components/schemas/webhookSchema" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "example": { + "data": { + "success": true, + "message": "Message with ID 268 has been approved." + } + } + } + } + } + } + } } }, "components": { diff --git a/management-apis.json b/management-apis.json index b568edcdd..365391720 100644 --- a/management-apis.json +++ b/management-apis.json @@ -9622,1418 +9622,6 @@ } ] } - }, - "/apps/{appId}/moderation/rules": { - "post": { - "tags": [ - "Moderation" - ], - "summary": "Add Rule", - "description": "Create a new moderation rule to specify actions and conditions for detecting and handling inappropriate content.", - "operationId": "create-rule", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ModerationRequestBody" - } - } - } - }, - "responses": { - "200": { - "description": "Created Rule", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/ModerationData" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "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" - } - } - } - } - } - } - }, - "get": { - "tags": [ - "Moderation" - ], - "summary": "List Rules", - "description": "Retrieve a list of all moderation rules.", - "operationId": "list-rules", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - }, - { - "name": "limit", - "in": "query", - "description": "The number of records to fetch.", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "List Rule", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - }, - "meta": { - "properties": { - "": { - "$ref": "#/components/schemas/metaSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "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" - }, - { - "id": "video-moderation1", - "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": 1720000488, - "updatedAt": 1720000488, - "revisionId": "253179cf5f665257_video-moderation1_1" - }, - { - "id": "text-profanity-filter", - "name": "Text Profanity filter", - "description": "Detect and censor profanity in text messages.", - "enabled": true, - "conditions": [ - { - "id": 1, - "isKeywordsReferencePresent": true, - "isMediaPresent": false, - "entity": "message", - "operand": "text", - "category": "word", - "operator": "contains", - "value": [ - "profanity-list" - ] - } - ], - "action": [ - "blockMessage" - ], - "active": true, - "createdAt": 1718355386, - "updatedAt": 1720006272, - "revisionId": "253157108b5294c4_profanity-filter_25", - "default": true - }, - { - "id": "image-moderation", - "name": "AI Image Moderation", - "description": "AI-powered image moderation to detect unsafe content.", - "enabled": false, - "conditions": [ - { - "id": 1, - "isKeywordsReferencePresent": false, - "isMediaPresent": true, - "entity": "message", - "operand": "image", - "category": "word", - "operator": "contains", - "value": [ - "AnyOf_greaterThan_30" - ] - } - ], - "action": [ - "blockMessage" - ], - "active": true, - "createdAt": 1718350200, - "updatedAt": 1719932600, - "revisionId": "253157108b5294c4_image-moderation_11", - "default": true - }, - { - "id": "video-moderation", - "name": "AI Video Moderation", - "description": "AI-powered video moderation to detect unsafe content.", - "enabled": false, - "conditions": [ - { - "id": 1, - "isKeywordsReferencePresent": false, - "isMediaPresent": true, - "entity": "message", - "operand": "video", - "category": "word", - "operator": "contains", - "value": [ - "AnyOf_greaterThan_30" - ] - } - ], - "action": [ - "dropMessage" - ], - "active": true, - "createdAt": 1718350199, - "updatedAt": 1720006008, - "revisionId": "253157108b5294c4_video-moderation_10", - "default": true - }, - { - "id": "custom-profanity-filter", - "name": "Custom Profanity filter", - "description": "Detect and censor profanity in custom messages.", - "enabled": false, - "conditions": [ - { - "id": 1, - "isListReferencePresent": true, - "isMediaPresent": false, - "entity": "message", - "operand": "custom", - "category": "word", - "operator": "contains", - "value": [ - "profanity-list" - ] - } - ], - "action": [ - "dropMessage" - ], - "active": true, - "createdAt": 1718341200, - "updatedAt": 1719819136, - "revisionId": "253157108b5294c4_profanity-filter_8", - "default": true - }, - { - "id": "contact_details_filter", - "name": "Contact details filter", - "description": "Identifies and removes phone numbers from text", - "enabled": false, - "conditions": [ - { - "id": 1, - "isKeywordsReferencePresent": false, - "isMediaPresent": false, - "entity": "message", - "operand": "text", - "category": "pattern", - "operator": "contains", - "value": [ - "\\\\+?(\\\\d{1,3})?{-.\\\\s}?\\\\(?\\\\d{1,4}?\\\\)?{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,9}" - ] - }, - { - "id": 2, - "isKeywordsReferencePresent": false, - "isMediaPresent": false, - "entity": "message", - "operand": "custom", - "category": "pattern", - "operator": "contains", - "value": [ - "\\\\+?(\\\\d{1,3})?{-.\\\\s}?\\\\(?\\\\d{1,4}?\\\\)?{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,4}{-.\\\\s}?\\\\d{1,9}" - ] - } - ], - "action": [ - "blockMessage" - ], - "active": true, - "createdAt": 1718186338, - "updatedAt": 1719836048, - "revisionId": "2531882e5e289115_contact_details_filter_3", - "default": true - }, - { - "id": "email_filter", - "name": "Email filter", - "description": "Identify and remove email address from messages", - "enabled": false, - "conditions": [ - { - "id": 1, - "isKeywordsReferencePresent": false, - "isMediaPresent": false, - "entity": "message", - "operand": "text", - "category": "pattern", - "operator": "contains", - "value": [ - "^{a-zA-Z0-9._%+-}+@{a-zA-Z0-9.-}+\\\\.{a-zA-Z}{2,}$" - ] - }, - { - "id": 2, - "isKeywordsReferencePresent": false, - "isMediaPresent": false, - "entity": "message", - "operand": "custom", - "category": "pattern", - "operator": "contains", - "value": [ - "^{a-zA-Z0-9._%+-}+@{a-zA-Z0-9.-}+\\\\.{a-zA-Z}{2,}$" - ] - } - ], - "action": [ - "blockMessage" - ], - "active": true, - "createdAt": 1718099938, - "updatedAt": 1719836049, - "revisionId": "2531882e5e289115_contact_email_filter_5", - "default": true - } - ], - "meta": { - "current": { - "limit": 50, - "count": 8 - } - } - } - } - } - } - } - } - }, - "/apps/{appId}/moderation/rules/{ruleId}": { - "get": { - "tags": [ - "Moderation" - ], - "summary": "Get Rule", - "description": "Retrieve details of a specific moderation rule by its ID.", - "operationId": "get-rule", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - }, - { - "$ref": "#/components/parameters/ruleId" - } - ], - "responses": { - "200": { - "description": "Get Rule", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": { - "id": "profanity-list", - "name": "Profane Words", - "category": "word", - "isCSV": false, - "searchTerms": [ - "fuck", - "damn", - "shit", - "cunt", - "nigga", - "nigger", - "wanker", - "cunt", - "fag", - "shithead", - "jizz", - "hellbitch", - "retard", - "cocksucker", - "cock", - "kill", - "kike", - "twat", - "bastard", - "death", - "asshole", - "wop", - "scumbag", - "penis", - "murder", - "dick", - "gook", - "vagina", - "rape", - "bastard", - "spic", - "spunk", - "beat" - ], - "createdAt": 1718354412, - "updatedAt": 1718354412, - "revisionId": "253157108b5294c4_profanity-list_1", - "active": true, - "default": true - } - } - } - } - } - } - }, - "put": { - "tags": [ - "Moderation" - ], - "summary": "Update Rule", - "description": "Update an existing moderation rule with new actions or conditions.", - "operationId": "update-rule", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - }, - { - "$ref": "#/components/parameters/ruleId" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ModerationRequestBody" - } - } - } - }, - "responses": { - "200": { - "description": "Update Rule", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "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" - } - } - } - } - } - } - }, - "delete": { - "tags": [ - "Moderation" - ], - "summary": "Remove rule", - "description": "Delete a specific moderation rule by its ID.", - "operationId": "delete-rule", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - }, - { - "$ref": "#/components/parameters/ruleId" - } - ], - "responses": { - "200": { - "description": "Delete Rule", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": { - "success": true, - "message": "Rule with id moderation-test has been deleted successfully." - } - } - } - } - } - } - } - }, - "/apps/{appId}/moderation/keywords": { - "post": { - "tags": [ - "Moderation" - ], - "summary": "Add Keywords", - "description": "Create a new keyword list for moderation.", - "operationId": "create-rule-keyword", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/KeywordList" - } - } - } - }, - "responses": { - "200": { - "description": "Created Keyword", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "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 - } - } - } - } - } - } - }, - "get": { - "tags": [ - "Moderation" - ], - "summary": "List keywords", - "description": "Fetches all the keywords.", - "operationId": "list-rule-keywords", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - } - ], - "responses": { - "200": { - "description": "List Keywords", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - }, - "meta": { - "properties": { - "": { - "$ref": "#/components/schemas/metaSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": [ - { - "_id": "66857afdb4bf371ddfba853b", - "id": "profane-word-list-1", - "appId": "253179cf5f665257", - "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, - "__v": 0 - }, - { - "_id": "666c01eccfe97336757fb611", - "id": "profanity-list", - "name": "Profane Words", - "category": "word", - "isCSV": false, - "searchTerms": [ - "fuck", - "nigger", - "fuck", - "nigger", - "wanker", - "cunt", - "damn", - "shit", - "fag", - "shithead", - "jizz", - "hellbitch", - "retard", - "cocksucker", - "cock", - "kill", - "cunt", - "kike", - "twat", - "bastard", - "death", - "asshole", - "wop", - "scumbag", - "penis", - "murder", - "dick", - "gook", - "vagina", - "rape", - "bastard", - "spic", - "spunk", - "beat" - ], - "createdAt": 1718354412, - "updatedAt": 1718354412, - "revisionId": "253157108b5294c4_profanity-list_1", - "active": true, - "__v": 0, - "default": true, - "appId": "default" - } - ], - "meta": { - "current": { - "limit": 10, - "count": 2 - } - } - } - } - } - } - } - } - }, - "/apps/{appId}/moderation/keywords/{keywordId}": { - "get": { - "tags": [ - "Moderation" - ], - "summary": "Get keyword", - "description": "Retrieve details of a specific keyword list by its ID.", - "operationId": "get-rule-keyword", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/keywordId" - }, - { - "$ref": "#/components/parameters/appId" - } - ], - "responses": { - "200": { - "description": "Get Keyword", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": { - "id": "profanity-list", - "name": "Profane Words", - "category": "word", - "isCSV": false, - "searchTerms": [ - "fuck", - "nigger", - "fuck", - "nigger", - "wanker", - "cunt", - "damn", - "shit", - "fag", - "shithead", - "jizz", - "hellbitch", - "retard", - "cocksucker", - "cock", - "kill", - "cunt", - "kike", - "twat", - "bastard", - "death", - "asshole", - "wop", - "scumbag", - "penis", - "murder", - "dick", - "gook", - "vagina", - "rape", - "bastard", - "spic", - "spunk", - "beat" - ], - "createdAt": 1718354412, - "updatedAt": 1718354412, - "revisionId": "253157108b5294c4_profanity-list_1", - "active": true, - "default": true - } - } - } - } - } - } - }, - "put": { - "tags": [ - "Moderation" - ], - "summary": "Update keyword", - "description": "Update an existing keyword list.", - "operationId": "update-rule-keyword", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/keywordId" - }, - { - "$ref": "#/components/parameters/appId" - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/KeywordList" - } - } - } - }, - "responses": { - "200": { - "description": "Update Keyword", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": { - "id": "profanity-list", - "name": "Profane Words", - "category": "word", - "isCSV": false, - "searchTerms": [ - "fuck", - "nigger", - "fuck", - "nigger", - "wanker", - "cunt", - "damn", - "shit", - "fag", - "shithead", - "jizz", - "hellbitch", - "retard", - "cocksucker", - "cock", - "kill", - "cunt", - "kike", - "twat", - "bastard", - "death", - "asshole", - "wop", - "scumbag", - "penis", - "murder", - "dick", - "gook", - "vagina", - "rape", - "bastard", - "spic", - "spunk", - "beat" - ], - "createdAt": 1718354412, - "updatedAt": 1718354412, - "revisionId": "253157108b5294c4_profanity-list_1", - "active": true, - "default": true - } - } - } - } - } - } - }, - "delete": { - "tags": [ - "Moderation" - ], - "summary": "Remove keyword", - "description": "Delete a keyword list by its ID.", - "operationId": "delete-rule-keyword", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/keywordId" - }, - { - "$ref": "#/components/parameters/appId" - } - ], - "responses": { - "200": { - "description": "Delete Keyword", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": { - "success": true, - "message": "Keyword with id profanity-list has been deleted successfully." - } - } - } - } - } - } - } - }, - "/apps/{appId}/moderation/rules/{ruleId}/revisions": { - "get": { - "tags": [ - "Moderation" - ], - "summary": "Get Rule Revisions", - "description": "Fetches a rule's revisions.", - "operationId": "list-rule-revisions", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - }, - { - "$ref": "#/components/parameters/ruleId" - } - ], - "responses": { - "200": { - "description": "List Rule revisions", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - }, - "meta": { - "properties": { - "": { - "$ref": "#/components/schemas/metaSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": [ - { - "id": "moderation-test", - "name": "Video Moderation", - "description": "AI-powered video moderation to detect unsafe content.", - "enabled": true, - "conditions": [ - { - "id": 1, - "isKeywordsReferencePresent": false, - "isMediaPresent": false, - "entity": "message", - "operand": "text", - "category": "word", - "operator": "equals", - "value": [ - "paris" - ] - } - ], - "action": [ - "blockMessage" - ], - "active": true, - "createdAt": 1720011899, - "updatedAt": 1720011905, - "revisionId": "253179cf5f665257_moderation-test_2" - }, - { - "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": false, - "createdAt": 1720011899, - "updatedAt": 1720011899, - "revisionId": "253179cf5f665257_moderation-test_1" - } - ], - "meta": { - "current": { - "limit": 10, - "count": 2 - } - } - } - } - } - } - } - } - }, - "/apps/{appId}/moderation/blocked-messages": { - "get": { - "tags": [ - "Moderation" - ], - "summary": "List Blocked Messages", - "description": "Lists the messages blocked by the moderation service.", - "operationId": "list-moderation-blocked-messages", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - } - ], - "responses": { - "200": { - "description": "List Blocked Messages", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - }, - "meta": { - "properties": { - "": { - "$ref": "#/components/schemas/metaSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": [ - { - "ruleId": "image-moderation", - "ruleName": "AI Image Moderation", - "revisionId": "253156be20433c97_image-moderation_4", - "condition": { - "id": 1, - "isKeywordsReferencePresent": false, - "isMediaPresent": true, - "entity": "message", - "operand": "image", - "category": "word", - "operator": "contains", - "value": [ - "Any unsafe content_greaterThan_70" - ], - "message": [ - "Image contains Any unsafe content with confidence greater than 70" - ], - "weight": 1 - }, - "message": { - "id": "65", - "muid": "_5zytzmceo", - "conversationId": "cometchat-uid-1_user_cometchat-uid-2", - "sender": "cometchat-uid-1", - "receiverType": "user", - "receiver": "cometchat-uid-2", - "category": "message", - "type": "image", - "data": { - "metadata": { - "file": [] - }, - "resource": "WEB-4_0_3-ffa565b2-476e-493d-aeb5-4c750aae3ab1-1719925738505", - "url": "https://data-eu.cometchat.io/2601293c931567f7/media/1719993037_336554568_9e044ea0ed5817381b189680f392bafe.jpeg", - "attachments": [ - { - "name": "download.jpeg", - "extension": "jpeg", - "size": 4761, - "mimeType": "image/jpeg", - "url": "https://data-eu.cometchat.io/2601293c931567f7/media/1719993037_336554568_9e044ea0ed5817381b189680f392bafe.jpeg" - } - ], - "entities": { - "sender": { - "entity": { - "uid": "cometchat-uid-1", - "name": "Andrew Joseph", - "avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp", - "status": "offline", - "role": "default" - }, - "entityType": "user" - }, - "receiver": { - "entity": { - "uid": "cometchat-uid-2", - "name": "George Alan", - "avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp", - "status": "offline", - "role": "default", - "conversationId": "cometchat-uid-1_user_cometchat-uid-2" - }, - "entityType": "user" - } - }, - "moderation": { - "status": "pending" - } - }, - "sentAt": 1719993037, - "updatedAt": 1719993037 - }, - "action": [ - "blockMessage" - ], - "createdAt": 1719993038, - "updatedAt": 1719993038 - } - ], - "meta": { - "current": { - "limit": 50, - "count": 20 - } - } - } - } - } - } - } - } - }, - "/apps/{appId}/moderation/blocked-messages/{messageId}": { - "patch": { - "tags": [ - "Moderation" - ], - "summary": "Approve Blocked Messages", - "description": "Approves the messages blocked by the moderation service.", - "operationId": "approve-moderation-blocked-messages", - "parameters": [ - { - "$ref": "#/components/parameters/key" - }, - { - "$ref": "#/components/parameters/secret" - }, - { - "$ref": "#/components/parameters/appId" - }, - { - "$ref": "#/components/parameters/messageId" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "status" - ], - "properties": { - "status": { - "description": "Moderation status of the message.", - "type": "string", - "example": "approved" - } - }, - "type": "object" - } - } - } - }, - "responses": { - "200": { - "description": "Approve Blocked Messages", - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "properties": { - "": { - "$ref": "#/components/schemas/webhookSchema" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "example": { - "data": { - "success": true, - "message": "Message with ID 268 has been approved." - } - } - } - } - } - } - } } }, "components": { @@ -17611,4 +16199,4 @@ "explorer-enabled": true, "proxy-enabled": true } -} \ No newline at end of file +}