+ Start a Discussion
Raghu NaniRaghu Nani 

How to calculate and display the average wait time for omnichannel customers

Hi Team,

In my org omnichannel set up is done and every time client to trying to connect the omnichanne chat, i would like to display the average wait time for responce. Please suggest how to proceed on this.

Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Raghu,
Please refer below link which might help you in this

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards
Raghu NaniRaghu Nani
Hi Devi,

Thanks for responding. I have setup already, I am trying to show the average wait time to customers who are waiting in chat through omnichannel.

Amrutanshu Giri 11Amrutanshu Giri 11
Hi Raghu,

Did you find any solution to this?

Raghu NaniRaghu Nani
Yes Amrutanshu Giri 11,

We have one api in salesforce to find the avarage wait time for button.
Alexandre Menezes 10Alexandre Menezes 10
Hi Raghu Nani,
Can you explain your solution in more detail?
Raghu NaniRaghu Nani
Hi Alexandre,

By following the below links I got the estimated wait time.

Please let me know if you need any details:


Sample code:
 global static String getEstimatedWaitTime(String org_Id, String deployment_Id, String button_id) {
        //String org_Id        = ApexPages.currentPage().getParameters().get('org_id');
        //String deployment_Id = ApexPages.currentPage().getParameters().get('deployment_id');
        //String button_id     = ApexPages.currentPage().getParameters().get('button_id');
        //String endPoint = 'https://hostname/chat/rest/Visitor/Settings';
          String endPointURL = 'https://xxxxxxxx.salesforceliveagent.com/chat/rest/Visitor/Settings?';
        endPoint = endPointURL + 'org_id='+org_Id+'&deployment_id='+deployment_Id+'&Settings.buttonIds='+button_id+'&Settings.needEstimatedWaitTime=1';
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('X-LIVEAGENT-API-VERSION', '47');
        HttpResponse response = http.send(request);
        //System.debug('response '+response.getBody());
Alexandre Menezes 12Alexandre Menezes 12
Hi Raghu Nani,

Which objects are these Ids from? org_Id, deployment_Id and button_id
Is the hostname my org? Ex:
String endPoint = 'https://my_org/chat/rest/Visitor/Settings';
String endPointURL = 'https://my_org.salesforceliveagent.com/chat/rest/Visitor/Settings?'