Conversations API participant attribute update mid-call not persisting

Context:
I’m attempting to update a participant’s attributes during an active conversation using the Conversations API via the Next.js server component. I’m using the standard PUT endpoint with the following payload:

const response = await fetch(`/api/v2/conversations/${conversationId}/participants/${participantId}/attributes`, {
 method: 'PATCH',
 headers: {
 'Authorization': `Bearer ${token}`,
 'Content-Type': 'application/json'
 },
 body: JSON.stringify({
 attributes: {
 "last_interaction_type": "complex_query",
 "priority": "high"
 }
 })
});

The request returns 200 OK, but when I fetch the participant details immediately after, the attributes object is empty or reverted. I’ve verified the token has the conversation:write scope.

Question:
Does anyone know if there are specific restrictions on which attributes can be modified mid-conversation, or is this a known latency issue with the webchat participant store?

It depends, but generally participantId from the client isn’t the server-side ID. You need the internal participantId from the conversation entity. Use the Node.js SDK to fetch the conversation first.

const conv = await platformClient.ConversationsApi.getConversationWebchat(conversationId);
const target = conv.participants.find(p => p.id === externalParticipantId);
await platformClient.ConversationsApi.patchConversationWebchatParticipant(conversationId, target.id, body);
1 Like
# Patch, don't replace. PUT overwrites missing fields.
conv = platform_client.conversations_api.get_conversation_webchat(conv_id)
p = next(x for x in conv.entities if x.id == part_id)
p.attributes.update({"key": "val"})
platform_client.conversations_api.patch_conversation_webchat_participant(conv_id, part_id, p)

Make sure you use PATCH. The previous answer missed that PUT replaces the entire object, wiping out system-managed fields like state or media. Patching preserves the rest. Python SDK handles the merge logic cleanly. Stop fighting the API semantics.

1 Like

The docs actually state that merging attributes via PATCH requires handling concurrency tokens to avoid data loss during high-throughput tracing. If you skip the If-Match header, your span context injection might silently fail when another process updates the participant.

PATCH /api/v2/conversations/{conversationId}/participants/{participantId}/attributes
If-Match: <etag_from_get>
Content-Type: application/json

{
 "attributes": {
 "traceId": "{yourTraceId}",
 "spanId": "{yourSpanId}"
 }
}
1 Like