diff --git a/src/pages/docs/chat/moderation/custom/index.mdx b/src/pages/docs/chat/moderation/custom/index.mdx index 1208c36ce7..2676670bd3 100644 --- a/src/pages/docs/chat/moderation/custom/index.mdx +++ b/src/pages/docs/chat/moderation/custom/index.mdx @@ -54,6 +54,15 @@ The request has the following JSON format. "action": "accept|reject", "rejectionDetail": { "key": "string" + }, + "message": { + "text": "string", + "metadata": { + "key": "any" + }, + "headers": { + "key": "string" + } } } ``` @@ -61,6 +70,12 @@ The request has the following JSON format. * `action`: Must be either `accept` or `reject`. `accept` means that the message will be published to the chat room, `reject` means it will be rejected. * `rejectionDetail`: Optional. If provided with `action: "reject"`, a map of string key-value pairs containing structured information about why the message was rejected. Both keys and values must be strings. This information may be sent back to clients via the `ErrorInfo.detail` field. The total response payload must not exceed 32 KiB in size. +* `message`: Optional. Omit this object to publish the original message unchanged. Provide it to modify the message before it is published. + +When provided, the `message` object behaves as a full replacement of the original message's `text`, `metadata`, and `headers`, not a partial update: + +* `text` is required and cannot be empty. Moderation fails if `text` is missing or empty. +* `metadata` and `headers` are optional. If you omit either one, it is removed from the published message. To preserve the original `metadata` or `headers`, copy them from the request `message` into the response. ### Error handling