Moderate comments
SDK platic.posts.comments.moderate()
Apply moderation at Meta and in Platica at the same time. You can protect a post even when the workspace has a pending payment.
Example
curl -X POST https://api.platic.ai/v1/posts/$POST_ID/comments/$COMMENT_ID/moderation \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "action": "hide" }' await platic.posts.comments.moderate("post_123", "comment_123", "hide"); Request body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | ✓ | hide, unhide, delete, spam or unspam |
| Action | What it does |
|---|---|
hide / unhide | Hides the comment from the public, or shows it again |
delete | Deletes it from Meta. It cannot be undone |
spam | Hides it, blocks the contact and, if it is the root comment, resolves the thread |
unspam | Reverts spam and reopens the thread if it had been resolved for spam |
{
"action": "hide"
} Response
data contains the comment's moderation state, with message: "Comment moderated". You also receive comment.updated or comment.deleted through webhooks.
Warning
With COMMENT_META_MODERATION_FAILED and details.localStatePersisted: true, Platica saved the moderation in the inbox, but Meta did not apply it. Retry the same call.
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | action is not valid, or the credential covers several workspaces and workspace is missing |
404 | NOT_FOUND | The post or the comment does not exist in the workspace |
422, 429, 502 or 504 | COMMENT_META_MODERATION_FAILED | Meta rejected the moderation, rate limited requests, failed or did not answer. Platica already saved it in the inbox (details.localStatePersisted: true). See the warning above |
See errors for the codes in this section.