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
}