Genesys CTI User Forum

Genesys CTI User Forum => Genesys-related Development => Topic started by: genesys_kumar on April 11, 2022, 03:33:40 PM

Title: Identifying Party Count in Chat Session
Post by: genesys_kumar on April 11, 2022, 03:33:40 PM
Hi,

is there a way we can find participant count in Chat conference?  I need to capture participant count (including customer and agents) when any one left the chat conference session, In the cometD event "ParticipantLeft" - there is no property shows the party count.

Thanks,
Kumar

Title: Re: Identifying Party Count in Chat Session
Post by: hsujdik on April 11, 2022, 05:14:55 PM
I don't think that there is a direct way to do that - at least, none that I know.

As an alternative, I think that you could use the "/genesys/2/chat/{serviceName}/{chatId}/refresh" endpoint with transcriptPosition = 1 and count the number of ParticipantJoined messages minus the number of ParticipantLeft messages.
Title: Re: Identifying Party Count in Chat Session
Post by: genesys_kumar on April 14, 2022, 12:37:51 PM
Thanks for the reply, I have tried as given below

Called this function on page load and it worked as expected

async function getParticipants() {
            [b]const requestPath = "/api/v2/me/chats?fields=*";
            const response = await callGWSAPI("GET", requestPath);[/b]

            if (response.statusCode == 0) {
                for (let i = 0; i < response.chats.length; i++) {
                    for (let j = 0; j < response.chats[i].participants.length; j++) {
                        if (response.chats[i].participants[j].type == "Agent" || response.chats[i].participants[j].type == "Supervisor") {
                            participants.push(response.chats[i].participants[j].id);
                        }
                    }
                }

                if (participants.length == 1) {
                    chatTimeoutEnabled = true;
                }
            } else {
                console.log("getParticipants response.statusCode != 0: " + response.statusCode);
            }

            console.log("chatTimeoutEnabled: " + chatTimeoutEnabled);
        }

Thanks,
Kumar