Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/pages/docs/chat/moderation/custom/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,28 @@ The request has the following JSON format.
"action": "accept|reject",
"rejectionDetail": {
"key": "string"
},
"message": {
"text": "string",
"metadata": {
"key": "any"
},
"headers": {
"key": "string"
}
}
}
```
</Code>

* `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 <a id="error"/>

Expand Down