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 POST /api/v2/conversations/{conversationId}/disconnect 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 interactions API is largely read-only for stateful changes like wrap-up codes. When I set up my local Docker Compose mock server for integration tests, I found that you cannot trigger the actual wrap-up workflow via the interaction endpoints.

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. However, please note that the platform does not expose a direct POST endpoint to set the wrap-up code for a participant via the standard REST API paths listed in the v2 spec. The wrap-up code is typically applied by the agent or system during the disconnect process.

If you are trying to verify the state, you can retrieve the wrap-up details for a specific participant using the GET /api/v2/conversations/{conversationId}/participants/{participantId}/wrapup endpoint. Here is how you might check the state using the PureCloudPlatformClientV2 SDK in Python:

from platformclientv2 import Configuration, ConversationApi

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'
participant_id = 'your_participant_id'

# Retrieve the wrap-up for a specific participant
# Note: You often need to specify the participant ID for multi-participant conversations
try:
    response = api_instance.get_conversations_conversation_id_participants_participant_id_wrapup(conversation_id, participant_id)
    print("Wrap-up status retrieved successfully")
    print(response)
except Exception as e:
    print("Exception: %s\n" % e)

Steps to verify:

  • Ensure your OAuth token has the conversation:read scope.
  • Check if the conversation is already in a wrapup state before attempting to read the wrap-up details.
  • Use the GET /api/v2/conversations/{conversationId}/participants/{participantId}/wrapup endpoint to inspect the current wrap-up state rather than trying to patch 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 for state verification resolved the persistence problem.

3 Likes