Update a conversation

SDK platic.conversations.update()

Change the editable details of one conversation: topic, and title on team chats. Status, operation, assignees, tags and the agent are not changed here: each has its own action, listed in Conversations.

Example

const { meta: read } = await platic.conversations.get("8Yc2kQ1mZ0rTq4Lp7WvX", { fields: ["topic"] });

const { data, meta } = await platic.conversations.update(
  "8Yc2kQ1mZ0rTq4Lp7WvX",
  { topic: "Refund for order 1042" },
  { fields: ["topic"], expectedVersion: read.resourceVersion },
);

console.log(data.topic, meta.changed, meta.effects.updatedFields);

The SDK sends an Idempotency-Key on every action and reuses it when it retries. expectedVersion is sent as If-Resource-Version; if the conversation changed since you read it, the call throws PreconditionFailedError with code VERSION_MISMATCH.

Sending the values the conversation already has changes nothing: the answer has meta.changed: false, nothing is written and no one is notified.

Path parameters

ParameterTypeDescriptionRequired
conversationIdstringThe conversation's id. Never a phone number or the old V1 conversationId key. See How IDs work✓

Headers

HeaderDescriptionRequired
Idempotency-KeyMakes the call safe to retry. 1 to 255 visible ASCII characters; a UUID works. See Retries—
If-Resource-VersionThe meta.resourceVersion of your last read or action. If the conversation changed since then, the answer is 412 VERSION_MISMATCH and nothing changes. Without it, the last write wins—

Query parameters

ParameterTypeDescription
fieldsstringFields of the conversation to return, comma-separated. Replaces the defaults; id is always returned. The fields are the same as in Get a conversation
includestringRelations to resolve in included: agents, channels, assignees
workspacestringThe workspace, for an API key that covers several. Other credentials always act on their own workspace

Request body

Send at least one field.

FieldTypeRequiredDescription
topicstring—Topic of the conversation, 1 to 200 characters
titlestring—Title, 1 to 200 characters. Only team chats (platform: "platica") have one. On any other conversation it returns 400 INVALID_REQUEST
{
  "topic": "Refund for order 1042"
}

Any other field returns 400 INVALID_REQUEST.

Response

The answer is the conversation after the change, read with fields and include as in Get a conversation, and a meta that says what the action did. This example used ?fields=id,topic.

{
  "status": "success",
  "data": {
    "id": "8Yc2kQ1mZ0rTq4Lp7WvX",
    "topic": "Refund for order 1042"
  },
  "meta": {
    "fields": ["id", "topic"],
    "include": [],
    "requestId": "req_7f3c",
    "resourceVersion": "MTc2NDYxMjAwMC4xMjM0NTY3ODk",
    "action": "update",
    "changed": true,
    "effects": {
      "updatedFields": ["topic"]
    },
    "replayed": false
  }
}
FieldDescription
dataThe conversation as it is now, with the selected fields
includedRelated records, only when you sent include
meta.actionAlways update
meta.changedfalse when the conversation already had those values: nothing was written and no one was notified
meta.effects.updatedFieldsThe fields that changed: topic, title or both. Empty when changed is false
meta.resourceVersionThe conversation's version after the change. Send it in If-Resource-Version on your next update
meta.replayedtrue when this is the stored outcome of an earlier call with the same Idempotency-Key. The update did not run again; data and resourceVersion show the conversation as it is now
meta.fields · meta.includeFields and relations applied
meta.requestIdID of the request, for support
meta.warningsOnly when there is something to report. CONVERSATION_NOT_READABLE: the change was applied, but your credential can no longer read the conversation, so data has only id

Retries

Send an Idempotency-Key so a retry after a lost answer is safe. A key belongs to one credential, one action and one conversation.

  • Same key, same body: you get the first outcome with meta.replayed: true. Nothing runs again. fields and include may change: they only choose what the answer shows.
  • Same key, different body: 409 IDEMPOTENCY_KEY_REUSED. Use a new key for a new change.
  • First call still running: 409 IDEMPOTENCY_IN_PROGRESS. Retry in a few seconds with the same key.
  • Lifetime: keys are kept for one day. A call that fails does not keep its key, so retrying it runs the update again.

Your access is checked again on every retry. More in Idempotency.

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTThe body, a query parameter or a header is not valid, or you sent title on a conversation that is not a team chat. details.issues says which
400INVALID_REQUESTThe workspace in ?workspace= is not covered by the credential. details.available lists the ones it covers
400INVALID_FIELDA name in fields does not exist. details.allowed lists the accepted ones
400INVALID_INCLUDEA name in include does not exist. details.allowed lists the accepted ones
401UNAUTHENTICATEDThe credential is missing or invalid
403FORBIDDENThe credential cannot change conversations, or your role can read this conversation but not change it
403INSUFFICIENT_SCOPEAn OAuth token without the platica:write scope. details.requiredScope says which one is missing
404CONVERSATION_NOT_FOUNDNo conversation has that id in the workspace, or it is out of your credential's reach
409IDEMPOTENCY_KEY_REUSEDThe Idempotency-Key was already used with a different body
409IDEMPOTENCY_IN_PROGRESSThe first call with this Idempotency-Key is still running. Retry shortly with the same key
412VERSION_MISMATCHIf-Resource-Version is not the current version. details.currentVersion has it. Nothing changed: read the conversation again and repeat
503ACTION_FAILEDThe outcome could not be confirmed (details.retryable: true). Repeat with the same Idempotency-Key: an update that already ran is not run again

The general error format is in Errors.