function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.

Regards,
Raghu
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Raghu,
Please refer below link which might help you in this
https://help.salesforce.com/articleView?id=omnichannel_supervisor_tabs_intro.htm&type=5
https://trailhead.salesforce.com/en/content/learn/modules/omni-channel-lex/omni-supervisor

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.

Regards,
Raghu
Amrutanshu Giri 11Amrutanshu Giri 11
Hi Raghu,

Did you find any solution to this?

Thanks,
Amrutanshu
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:

https://developer.salesforce.com/docs/atlas.en-us.live_agent_rest.meta/live_agent_rest/live_agent_rest_estimated_wait_time.htm
https://developer.salesforce.com/docs/atlas.en-us.live_agent_rest.meta/live_agent_rest/live_agent_rest_Availability.htm

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');
        request.setEndpoint(endPoint);
        request.setMethod('GET');
        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?'