Assign a conversation

SDK platic.conversations.assignees.set()
SDK platic.conversations.assignees.update()

Choose which team members are responsible for a conversation. Name each member by their member ID or their email.

  • PUT replaces the list: the conversation ends with exactly the members you send. An empty list removes them all.
  • PATCH adds and removes some members in one step, without sending the whole list.

Assigning the conversation to the whole team is a separate switch, assignedToTeam, on both. Never send team as a member.

Example

// Add and remove
await platic.conversations.assignees.update("8Yc2kQ1mZ0rTq4Lp7WvX", { add: ["luis@acme.com"] });

// Replace, guarded by the version you read
const { data, meta } = await platic.conversations.get("8Yc2kQ1mZ0rTq4Lp7WvX", { fields: ["assigneeIds"] });
const result = await platic.conversations.assignees.set(
  "8Yc2kQ1mZ0rTq4Lp7WvX",
  { assigneeIds: [...(data.assigneeIds ?? []), "luis@acme.com"], assignedToTeam: false },
  { expectedVersion: meta.resourceVersion },
);

console.log(result.meta.effects.notified);

The SDK sends an Idempotency-Key on every action and reuses it when it retries. A member who is not active in the workspace throws InvalidConfigError with code INVALID_ASSIGNEE.

Use PATCH when you only want to add or remove someone: two callers can do it at the same time without overwriting each other. Use PUT when you have the whole list, and send If-Resource-Version so you do not overwrite a change made since you read it.

Who is notified

Only the members added by the call are notified, once, the same way as when someone assigns them from the inbox: in the app, by email, by WhatsApp and by push, following each member's access and preferences. meta.effects.notified lists them. If the notification could not be sent, the assignment stays and notified is empty.

Members who were already assigned, members removed, and repeated calls notify no one.

Rules

  • Each member is a member ID or an email of the workspace. An email that is not a member returns 422 INVALID_ASSIGNEE before anything changes.
  • Only the members being added must be active. Keeping or removing a member does not depend on their status.
  • add and remove cannot name the same member.
  • assignedToTeam is true to assign the whole team and false to unassign it. Left out, it does not change.
  • A conversation can have up to 50 assignees.
  • If the result is the same as before, the answer has meta.changed: false: nothing is written, no webhook is sent and no one is notified.

Path parameters

ParameterTypeDescriptionRequired
conversationIdstringThe conversation's id. 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-VersionPUT only. The 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. PATCH does not need it: sending it returns 400 INVALID_REQUEST—

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. assignees adds each member's name and email
workspacestringThe workspace, for an API key that covers several. Other credentials always act on their own workspace

Request body

PUT: replace

FieldTypeRequiredDescription
assigneeIdsstring[]✓The members the conversation ends with, by member ID or email, up to 50. Each one up to 256 characters, without spaces. [] removes them all
assignedToTeamboolean—true assigns the whole team; false unassigns it. Left out, it does not change
{
  "assigneeIds": ["usr_ana", "luis@acme.com"],
  "assignedToTeam": false
}

PATCH: add and remove

Send at least one field.

FieldTypeRequiredDescription
addstring[]—Members to assign, by member ID or email, up to 50
removestring[]—Members to unassign, by member ID or email, up to 50
assignedToTeamboolean—true assigns the whole team; false unassigns it. Left out, it does not change
{
  "add": ["luis@acme.com"],
  "remove": ["usr_ana"]
}

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. Members sent by email come back as member IDs. This example used ?fields=id,assigneeIds,assignedToTeam.

{
  "status": "success",
  "data": {
    "id": "8Yc2kQ1mZ0rTq4Lp7WvX",
    "assigneeIds": ["usr_ana", "usr_luis"],
    "assignedToTeam": false
  },
  "meta": {
    "fields": ["id", "assigneeIds", "assignedToTeam"],
    "include": [],
    "requestId": "req_7f3c",
    "resourceVersion": "MTc2NDYxMjAwMC4xMjM0NTY3ODk",
    "action": "assignees",
    "changed": true,
    "effects": {
      "added": ["usr_luis"],
      "removed": [],
      "assignedToTeam": false,
      "notified": ["usr_luis"]
    },
    "replayed": false
  }
}
FieldDescription
dataThe conversation as it is now, with the selected fields
includedRelated records, only when you sent include
meta.actionAlways assignees
meta.changedfalse when the conversation already had that result: nothing was written and no one was notified
meta.effects.addedMember IDs assigned by this call
meta.effects.removedMember IDs unassigned by this call
meta.effects.assignedToTeamWhether the whole team is assigned after the call
meta.effects.notifiedMember IDs that were notified. Empty if the notification could not be sent
meta.resourceVersionThe conversation's version after the change. Send it in If-Resource-Version on your next PUT
meta.replayedtrue when this is the stored outcome of an earlier call with the same Idempotency-Key. Nothing ran again and no one was notified 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 (for example, you unassigned yourself and your role only sees its assigned conversations), 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 and no one is notified 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 action 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: a list with more than 50 members, team sent as a member, add and remove naming the same member, or If-Resource-Version on PATCH. 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_MISMATCHPUT only: If-Resource-Version is not the current version. details.currentVersion has it. Nothing changed: read the conversation again and repeat
422INVALID_ASSIGNEESome members being added are not active members of the workspace. details.invalidAssigneeIds lists the IDs or emails
422TOO_MANY_ASSIGNEESThe conversation would end with more than 50 assignees
503ACTION_FAILEDThe outcome could not be confirmed (details.retryable: true). Repeat with the same Idempotency-Key: an action that already ran is not run again

The general error format is in Errors.

Notes

Every call that changes the assignees sends conversation.owners.updated with source: "api.conversation.v2", or "mcp.conversation.v2" when your assistant did it.