Setting wrap-up codes via Conversations API after interaction close

Looking for advice on programmatically assigning wrap-up codes after an interaction ends.

I am attempting to update the conversation via PATCH /api/v2/interactions/interactions/{conversationId} with the following payload:

{
 "wrapup": {
 "code": "WRAP-001",
 "label": "Data Entry"
 }
}

The API returns 200 OK, but the code does not persist in the UI or analytics. Is this endpoint read-only for wrap-up fields, or is there a specific sequence required?

Take a look at at the genesyscloud.wrapupcode resource in the Terraform provider. I got a 200 OK that ignored my payload too. The issue was likely missing the wrapupCodeId instead of just the label.

Check your provider version. I used v1.50.0 and had to explicitly link the code ID in the state. Using the SDK platformClient.wrapup.update worked better for me than the raw API patch.

I’d recommend looking at at the distinction between the interaction entity and the conversation wrap-up state. The PATCH /api/v2/interactions/interactions/{conversationId} endpoint often reflects metadata changes rather than triggering the actual wrap-up workflow in the Genesys Cloud platform. When I set up my local Docker Compose mock server for integration tests, I found that the interactions API is largely read-only for stateful changes like wrap-up codes.

The suggestion above about using the SDK is on the right track, but the specific endpoint matters. You should use the Conversations API to actually close and wrap up the interaction. Here is the correct approach using the PureCloudPlatformClientV2 SDK in Python:

from platformclientv2 import Configuration, ConversationApi
from platformclientv2.models import ConversationWrapup

config = Configuration()
config.host = 'https://api.mypurecloud.com'
# Configure OAuth2 access token authentication
config.access_token = 'your_access_token'

api_instance = ConversationApi(config)
conversation_id = 'your_conversation_id'

# Define the wrap-up code
wrapup = ConversationWrapup(
 code="WRAP-001",
 label="Data Entry"
)

# Update the wrap-up for a specific participant or the whole conversation
# Note: You often need to specify the participant ID for multi-participant conversations
try:
 api_instance.post_conversations_conversations_id_wrapup(conversation_id, wrapup)
 print("Wrap-up code applied successfully")
except Exception as e:
 print("Exception: %s\n" % e)

Steps to verify:

  • Ensure your OAuth token has the conversation:write scope.
  • Check if the conversation is already in a wrapup state before calling the endpoint.
  • Use the POST /api/v2/conversations/conversations/{conversationId}/wrapup endpoint instead of patching the interaction directly.

This approach aligns with how the platform handles state transitions internally. I ran into this same issue when testing my Terraform modules against the mock API, and switching to the Conversations API resolved the persistence problem.