Moderate a contact
Block, unblock or reset a contact's strikes. The API updates their moderation and affected conversations.
Example
curl -X PATCH https://api.platic.ai/v1/clients/$CLIENT_ID/moderation \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "blocked", "reason": "Abusive messages" }' await platic.clients.block("client_123", { reason: "Abusive messages" }); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | string | Can be the contact's ID or their phone number in E.164 format without + | ✓ |
Request body
You must send at least one of status, resetStrikes or clearHistory.
| Field | Type | Required | Description |
|---|---|---|---|
status | enum | — | blocked to block, active to unblock |
reason | string | — | Reason for the block, which gets recorded. Maximum 120 characters. Only applies with status: "blocked". Default: api_request |
resetStrikes | boolean | — | Sets the strikes to zero. Implicit when you send status: "active" |
clearHistory | boolean | — | Also erases the record of the last offense |
How to do each operation
Block
{ "status": "blocked", "reason": "reported_abuse" } Unblock
{ "status": "active" } Reset the strikes without unblocking
{ "resetStrikes": true } Unblock and erase the whole moderation history
{ "status": "active", "clearHistory": true } What each field does
status: "blocked"
- It leaves the contact with
status: "blocked", so their future conversations are born marked as spam and agents skip them. - It records
moderation.blockedAt,moderation.blockedByandmoderation.blockedReason. - It marks as
spamthe conversations the contact already had open, so the block applies right away. Those already inspam,finishedorexpiredare not touched.
Blocking stops replies in open threads. You may receive a conversation.status.updated for each affected thread, in addition to client.updated.
status: "active"
- It leaves the contact with
status: "active"and clears themoderation.blocked*fields. - It sets the strikes to zero, even if you did not ask for it.
- It returns to
finishedthe conversations that were inspam.
resetStrikes and clearHistory
resetStrikes sets moderation.totalStrikes to zero and erases moderation.lastAction. clearHistory also erases moderation.lastFlaggedAt, lastSource, lastCategories, lastMatchedTerms and lastSeverity.
Neither changes the status: resetting strikes does not unblock the contact. You can clear accumulated violations without changing their status.
Response
{
"status": "success",
"message": "Client moderation updated successfully",
"data": {
"id": "274fc73cb7d84a17955914fdc1a1f9d0",
"status": "active",
"strikesReset": true,
"clearedHistory": false,
"previousStrikes": 3,
"conversationsUpdated": 2
}
} | Field | Description |
|---|---|
id | Internal ID of the contact |
status | Status the contact ended up with |
strikesReset | Whether the strikes were set to zero |
clearedHistory | Whether the record of the last offense was erased |
previousStrikes | Strikes the contact had before the call |
conversationsUpdated | How many conversations were synced. Always 0 if you did not send status |
Errors
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | The body asks for nothing (details.issues points at status), has unknown fields, status is not active or blocked, or reason is not between 1 and 120 characters |
400 | INVALID_REQUEST | The credential covers several workspaces and ?workspace= is missing, or the supplied workspace is not authorized. details.available lists the available ones and details.requested shows the one you sent |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | The credential does not have the Contacts module (Missing contacts permission), or the user's role is read-only |
403 | INSUFFICIENT_SCOPE | An OAuth token without the platica:write scope tried to write. details.requiredScope says which one is missing |
404 | CLIENT_NOT_FOUND | No contact in that workspace has that identifier, it was deleted, or it is outside the reach of the user's role |
409 | MULTIPLE_CONTACTS_MATCH | Two contacts have that email: use the ID. details.clientIds lists them |
The general error format is in Errors.
Notes
Webhooks
| What you sent | source of client.updated |
|---|---|
status: "blocked" | api.client.blocked |
status: "active" | api.client.unblocked |
Only resetStrikes / clearHistory | api.client.strikes_reset |
When you send status you also receive a conversation.status.updated for each synced conversation.
PATCH /v1/clients/{id} with {"status": "blocked"} also applies this moderation and accepts an ID, phone number or email. Use the ID for webchat, Instagram or Telegram contacts that have no phone number.