Editar

Partilhar via


getAgentAvailability

Omnichannel for Customer Service offers a suite of capabilities that extend the power of Dynamics 365 Customer Service Enterprise to enable organizations to instantly connect and engage with their customers across digital messaging channels. An additional license is required to access Omnichannel for Customer Service. For more information, see the Dynamics 365 Customer Service pricing overview and Dynamics 365 Customer Service pricing plan pages.

Retrieves the agent availability for a queue based on the routing rules. The omnichannel developer can use this API to determine whether the start conversation option should be visible to the customer and also for displaying information such as wait time and position in queues.

Note

  • Listen for the lcw:ready event raised by a live chat before calling the live chat SDK methods. The live chat methods should be invoked after the lcw:ready event is raised. You can listen for this event by adding your own event listener on the window object.
  • This method can be called multiple times from the client side when customer input changes. The client side cache is refreshed every 2 minutes or when the customer context parameters change.
  • This method can be called 100 times per minute per organization only. If you've exceeded the limit, you'll see the http 429 response status code that indicates that you've sent too many requests in a specified amount of time.

Syntax

Microsoft.Omnichannel.LiveChatWidget.SDK.getAgentAvailability();

Parameters

None

Return value

Name Type Description
queueId String The target queue where the request will be routed​ based on routing rule configuration and input data (value of entity and context which are part of routing rule are provided).
isQueueAvailable Boolean Displays:
- TRUE if the queue is within operating hours.
- FALSE if the queue is outside operating hours.
StartTimeOfNextOperatingHour DateTime The start time (UTC) of operating hours for the queue if it's outside operating hours​. During operating hours, a value of 01-01-0001 is returned.
EndTimeOfNextOperatingHour DateTime The time (UTC) when operating hours end for the queue if it's outside operating hours. During operating hours, a value of 01-01-0001 is returned.
nexttransitiontime DateTime The time (UTC) when the queue is operational again if it's outside operating hours. The time when the queue is not operational is displayed during operating hours.
positionInQueue Number The position in queue for a customer waiting behind other customers in the same queue​.
isAgentAvailable Boolean Displays:
- TRUE if agents in the queue are currently available to take requests based on configured routing and assignment rules for workstream. The API also returns true if a bot is attached to the workstream or a queue. We recommend that this API be not used when a bot is present.
- FALSE if agents aren't available to take requests.
averageWaitTime Number Average wait time in minutes for customers in the target queue based on past 48-hour data.

Example

window.addEventListener("lcw:ready", function handleLivechatReadyEvent(){
               // Gets the agent availability
               Microsoft.Omnichannel.LiveChatWidget.SDK.getAgentAvailability();
});

startChat
setContextProvider
Live chat SDK reference