Error while trying to add agent as a participant to an ongoing ACD conversation

Error while trying to add agent as a participant to an ongoing ACD conversation

ACD conversation details :
This is an ACD conversation scenerio where a conversation is happening between a genesys agent and an external user. They are communicating over our organisation platform iframe embedded inside genesys platform

We are trying to add another agent as participant to this ongoing conversation using this SDK call - conversationsApi.PostConversationsCallParticipants

When calling this function conversationsApi.PostConversationsCallParticipants is throwing this error

"error": "POST https://api.usw2.pure.cloud/api/v2/conversations/calls/54db338c-3d59-4e4b-90e5-bc65a3423243/participants giving up after 1 attempt(s)"

Golang SDK we are using - "github.com/mypurecloud/platform-client-sdk-go/v129/platformclientv2"

Please let us know how to resolve this issue or If there is another function to be used for adding participant to ongoing conversation, please provide information about that.

Sample code snippets are mentioned below


func AddAnotherAgentToConversation(conversationID string, externalAcdUserId string, userToken string) error {

	genesysConfig, err := GetGenesysConfigV2(userToken)
	if err != nil {
		log.Error("Error fetching Genesys configuration", zap.Error(err))
		return err
	}

	conversationsApi := genesysplatformclient.NewConversationsApiWithConfig(genesysConfig)

	genesysConversation, _, err := conversationsApi.GetConversation(conversationID)
	if err != nil {
		log.Error("Error fetching Genesys conversation", zap.Error(err))
		return fmt.Errorf("error fetching Genesys conversation: %w", err)
	}

	if genesysConversation.Participants == nil {
		return errors.New("the Genesys conversation has no participants")
	}

	newAgentParticipant := genesysplatformclient.Participant{
		UserId:          &externalAcdUserId,
		Purpose:         genesysplatformclient.String("agent"),
		ParticipantType: genesysplatformclient.String("agent"),
	}

	conv := genesysplatformclient.Conversation{
		Participants: &[]genesysplatformclient.Participant{
			newAgentParticipant,
		},
	}

	log.Info("Adding new agent participant", zap.String("agentID", externalAcdUserId), zap.String("conversationID", conversationID))

	data, resp, err := conversationsApi.PostConversationsCallParticipants(conversationID, conv)
	if err != nil {
		log.Error("Error adding agent participant", zap.Error(err))
		return fmt.Errorf("error calling PostConversationsCallParticipants: %w", err)
	}

	return nil
}


func GetGenesysConfigV2(userToken string) (*genesysplatformclient.Configuration, error) {

	genesysConfig := genesysplatformclient.GetDefaultConfiguration()

	genesysConfig.BasePath = genesysplatformclient.USWest2

	genesysConfig.AccessToken = userToken

	return genesysConfig, nil

}

Hello,

I would suggest to enable logging at SDK level so you may see if you get an error back to your request and which one.
See Go SDK Logging

Note that current version of the Platform API Go SDK is v151. I would suggest to update your sdk version.

I have tried your AddAnotherAgentToConversation function, providing proper conversationID and Genesys Cloud User/Agent ID and a userToken (user oriented token - associated with the agent who is in the call with the customer), and it worked. I was using v151 of the SDK.

Regards,

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.