Author Topic: Identifying Party Count in Chat Session  (Read 1457 times)

Offline genesys_kumar

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
Identifying Party Count in Chat Session
« on: April 12, 2022, 12:33:40 AM »
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


Offline hsujdik

  • Hero Member
  • *****
  • Posts: 501
  • Karma: 23
Re: Identifying Party Count in Chat Session
« Reply #1 on: April 12, 2022, 02:14:55 AM »
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.

Offline genesys_kumar

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
Re: Identifying Party Count in Chat Session
« Reply #2 on: April 14, 2022, 09: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() {
            const requestPath = "/api/v2/me/chats?fields=*";
            const response = await callGWSAPI("GET", requestPath);


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

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

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

Thanks,
Kumar