MindBehind Live: WaitingTime Calculation for Client &Agent

MindBehind Live: WaitingTime Calculation for Client &Agent


The waiting time for agent and client represents the average time each had to wait in between messages. For example: (Message order timeline): C = Client message, A = Agent message

C1→ C2→ A1→ C3

In this case the client wait time is calculated as the difference between C1→A1, this is the time client waited to receive a message from the agent and the agent wait time will be A1→C3.


1- The duration between agent assignment time to agent first response is added to the client waited time.

2- We will always consider the number of responses, not the message numbers (after a response from the agent or client, they can continue to send messages to explain situations, but all will be considered as a single response, and the time of the first message will be considered.

3- Who ended the conversations is important to calculate the waiting time as explained below.

Calculation Rules

1. If the last message was sent by the agent and

2. If the last message was sent by the client and

Prerequisites for Calculations

  • The client and agent wait times are not calculated for bot conversations
  • There should be an agent assigned to the conversation
  • The conversation has ended

Calculation example


For this case the total client wait time will be: C1→A1 + C2→A2 as C3 is still waiting for the agent to respond and the conversation has closed on the agent so only the previous two are considered. The agent wait time will be A1→C2 + A2→C3 and agent is not waiting for a client response at this stage.

Technical Details

On the backend side we have implemented the rules and calculations by creating additional variables called:

  • totalClientWaitTimeInSeconds
  • totalAgentWaitTimeInSeconds
  • timesClientWaited
  • timesAgentWaited
  • isAgentWaiting
  • lastClientResponseTime
  • lastAgentResponseTime

By using the total wait timings and diving them by the count/times waited count we are able to calculate the average wait times that are stored as:averageAgentWaitTime,averageClientWaitTime in the conversation table.

isAgentWaiting is a boolean value representing the state of the agent, i.e. is the agent currently waiting for a message from the client = true and if not then false. The false value also suggests that the client is waiting for the agent to respond.

lastClientResponseTime and lastAgentResponseTime are used to keep track of who sent the last message time, this last message will be C1 in this flow: C1→C2→C3→C4→A1 this means its the time of the last message sent by the client or agent after which they have been waiting for a response.

A flow chart created to explain the calculation when ending the conversation:

    • Related Articles

    • How to Set Up Voting for WhatsApp

      Whatsapp vote is a voting system developed for users to be able to rate WhatsApp conversations. How to set it up After logging into Mindbehind, go to your company from the “Companies” on navigation panel. Go to "Channels" tab on company management ...
    • How do I activate my account?

      You should receive an email from the platform asking for your email verification.     Click the button to verify your email address and activate your account. The button should take you directly to the MindBehind Platform.   If you have not received ...
    • How do I create an account?

       Start creating your MindBehind Account by following this link.     This is the signup page where you can register for a new account. Continue to fill in the required fields and your desired password.   Note that your password must be at least 8 ...
    • What are the On Premise Installation Requirements for Small-Medium Businesses?

      OS Node VM CPU(Core) Memory(GB) Storage(GB) Redhat/Centos K8s Cluster Master Node 1 4 8 100 Redhat/Centos K8s Cluster Master Node 2 4 8 100 Redhat/Centos K8s Cluster Master Node 3 4 8 100 Redhat/Centos K8s Cluster Worker Node 1 4 8 100 Redhat/Centos ...