Newer Version Available
Using Estimated Wait Time Instead of Queue Position for a Chat Session (Beta)
By default, the Chat API returns queue position information that you can relay to
customers. However, you can also receive the estimated wait time in addition to the queue
position. Sometimes, the estimated wait time more effectively conveys the right information to
customers than a queue position number. This feature is available in API version 47.0 and
later.
The following algorithm is used to calculate the wait time:
1A = (0.9 * A′) + (0.1 * W)Where:
- A′ is the previous value for A. If no previous value exists, this value is W.
- W is the wait time of the chat that has most recently been accepted.
The value returned is the value of A minus the time already spent waiting.
Additional algorithm details:
- This value is calculated separately for each chat button.
- A is recalculated each time a chat is accepted.
- 0 is returned if the result is less than 0.
- -1 is returned when the value cannot be calculated.
To use this feature, specify that you want the estimated wait time from the Settings request (by setting Settings.needEstimatedWaitTime to 1) and the Availability request (by setting Availability.needEstimatedWaitTime to 1). When this value is set to 1, the response includes the estimated wait time for each button ID requested.
If receiveQueueUpdates is set when initializing the session, ChatRequestSuccess and QueueUpdate will both contain the estimated wait time (in seconds) in their responses.