Moderate a contact

SDK platic.clients.block()

Block, unblock or reset a contact's strikes. The API updates their moderation and affected conversations.

Example

await platic.clients.block("client_123", { reason: "Abusive messages" });

Path parameters

ParameterTypeDescriptionRequired
idstringCan 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.

FieldTypeRequiredDescription
statusenum—blocked to block, active to unblock
reasonstring—Reason for the block, which gets recorded. Maximum 120 characters. Only applies with status: "blocked". Default: api_request
resetStrikesboolean—Sets the strikes to zero. Implicit when you send status: "active"
clearHistoryboolean—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"

  1. It leaves the contact with status: "blocked", so their future conversations are born marked as spam and agents skip them.
  2. It records moderation.blockedAt, moderation.blockedBy and moderation.blockedReason.
  3. It marks as spam the conversations the contact already had open, so the block applies right away. Those already in spam, finished or expired are not touched.

status: "active"

  1. It leaves the contact with status: "active" and clears the moderation.blocked* fields.
  2. It sets the strikes to zero, even if you did not ask for it.
  3. It returns to finished the conversations that were in spam.

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
  }
}
FieldDescription
idInternal ID of the contact
statusStatus the contact ended up with
strikesResetWhether the strikes were set to zero
clearedHistoryWhether the record of the last offense was erased
previousStrikesStrikes the contact had before the call
conversationsUpdatedHow many conversations were synced. Always 0 if you did not send status

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTThe 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
400INVALID_REQUESTThe 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
401UNAUTHENTICATEDThe credential is missing or invalid
403FORBIDDENThe credential does not have the Contacts module (Missing contacts permission), or the user's role is read-only
403INSUFFICIENT_SCOPEAn OAuth token without the platica:write scope tried to write. details.requiredScope says which one is missing
404CLIENT_NOT_FOUNDNo contact in that workspace has that identifier, it was deleted, or it is outside the reach of the user's role
409MULTIPLE_CONTACTS_MATCHTwo contacts have that email: use the ID. details.clientIds lists them

The general error format is in Errors.

Notes

Webhooks

What you sentsource of client.updated
status: "blocked"api.client.blocked
status: "active"api.client.unblocked
Only resetStrikes / clearHistoryapi.client.strikes_reset

When you send status you also receive a conversation.status.updated for each synced conversation.