1. Open the webChatConfig.js file
    Change following three lines:
        notifyOfObserve : true,
        notifyOfCoach : true,
        notifyOfBarge : true    
    With the following lines:
        notifyOfObserve : false,
        notifyOfCoach : false,
        notifyOfBarge : false

2. Open the webChat.js file

2.1 Add following line:
        joinedAgents : {},
    After line:
        hideElements : [ 'chatPanelHidden', 'configPanel' ],

    
2.2 In the function notifyNewParticipant    
    
    Add line:
        var agents = body.participants;
    After line:
        var role = body.role;

        
2.3 Replace all lines between code: 
        if (id === 'AvayaAutomatedResource') {
            webChat.chatBotName = body.displayName;
        }

        And 
            webChat.updateUsers(agents);
        
    
        With following lines:
            var roles = webChat.joinedAgents[id];
            // save checked supervior states
            if (webChat.checkAgentVisibility(id, role)) {
                if (roles === undefined) {
                    for (var i = 0; i < agents.length; i++) {
                        roles = [];
                        roles.push(agents[i].type);
                        webChat.joinedAgents[agents[i].id] = roles;
                    }
                } else {
                    roles.push(role);
                    webChat.joinedAgents[id] = roles;
                }
           
                webChat.writeResponse(chatConfig.agentJoinedMessage, chatConfig.writeResponseClassSystem);
           
            
            } else if (roles !== undefined) {
                while (roles.pop() !== undefined) {
                    webChat.writeResponse(chatConfig.agentLeftMessage, chatConfig.writeResponseClassSystem);
                }
            }

2.4 Replace all lines in function checkAgentVisibility with:
    
        'use strict';
        // check if notifications are allowed/required
        if (webChat.isBotVisible(id)) {
            return true;
        }
        
        if(webChat.isAgentActive(role)){
            return true;
        }
        
        // if notifications are allowed/required, display them
        var isVisible = webChat.isSupervisorVisible(role);
        if (isVisible) {
            return true;
        }
        return false;

2.5 Add the following functions to webChat.js:
        
        isAgentActive : function (role) {
            return role === 'active_participant';
        },
    
        isBotVisible : function (id) {
            var announceBot = (id === 'AvayaAutomatedResource' && !chatConfig.suppressChatbotPresence);
            return announceBot;
        },
    
        isSupervisorVisible : function (role) {
            var announceObserve = (role === 'supervisor_observe' && chatConfig.notifyOfObserve);
            var announceCoach = (role === 'supervisor_coach' && chatConfig.notifyOfCoach);
            var announceBarge = (role === 'supervisor_barge' && chatConfig.notifyOfBarge);
            return announceObserve || announceCoach || announceBarge || (role === 'passive_participant' && chatConfig.notifyOfBarge); 
        },

2.6 Add the following lines in function notifyParticipantLeave:
        
        if (agents.length !== 0) {
            var savedAgentRoles = webChat.joinedAgents[id];
        }
        
    Before line:  
        var leaveReason = body.leaveReason.toLowerCase();
        


    Remove line:
        var suppressBot = (leaveReason === 'escalate' && chatConfig.suppressChatbotPresence);

    

    After block of code:
        if (Object.keys(body.participants).length === 0) {
            console.info('WebChat: Only the customer remains in the room.');
            chatUI.disableControls(true);
            webChat.startOnHoldMessages();

            if (leaveReason === 'transfer') {
                webChat.writeResponse(chatConfig.transferNotificationText, chatConfig.writeResponseClassSystem);
            } else if (leaveReason === 'requeue') {
                webChat.writeResponse(chatConfig.requeueNotificationText, chatConfig.writeResponseClassSystem);
            } else if (leaveReason === 'escalate' && !chatConfig.suppressChatbotPresence) {
                webChat.writeResponse(chatConfig.chatbotTransferNotification, chatConfig.writeResponseClassSystem);
            } else if (leaveReason === 'transfer_to_user') {
                webChat.writeResponse(chatConfig.transferToUserText, chatConfig.writeResponseClassSystem);
            } else {
                webChat.writeResponse(chatConfig.agentLeftMessage, chatConfig.writeResponseClassSystem);
            }

        } else {

    Add the following block of code:
            if (savedAgentRoles !== undefined) {
                var otherParticipant;
                for (var i = 0; i < agents.length; i++) {
                    if (agents[i].id !== id) {
                        otherParticipant = agents[i].id;
                    }
                }
                var savedRolesOtherParticipant = webChat.joinedAgents[otherParticipant];
                if (savedAgentRoles.includes('supervisor_observe') || savedAgentRoles.includes('supervisor_coach')) {
                    if (savedAgentRoles.includes('supervisor_barge')) {
                        savedAgentRoles.pop()
                    }
                    while (savedAgentRoles.shift() !== undefined) {
                        webChat.writeResponse(chatConfig.agentLeftMessage, chatConfig.writeResponseClassSystem);
                    }
                } else if (agents.length === 1 && (savedAgentRoles.includes('passive_participant')
                        || savedRolesOtherParticipant.includes('supervisor_barge'))) {
                    webChat.writeResponse(chatConfig.transferNotificationText, chatConfig.writeResponseClassSystem);
                    savedAgentRoles.shift();
                }
            }
            if (savedAgentRoles.length === 0) {
                delete webChat.joinedAgents[id];
            }
        }
        webChat.updateUsers(agents);


2.7 Add the line in function quitChat:
            webChat.joinedAgents = {};

        After line: 
            webChat.clearAllTimeouts();


2.8 In function updateUsers change the following line:
        if (webChat.checkAgentVisibility(agent.id, agent.type) || agent.type === 'passive_participant') {
        
    With line:
        if (webChat.checkAgentVisibility(agent.id, agent.type)) {

        




    
