Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Use the representative availability APIs to retrieve information about queue and customer service representative availability in Dynamics 365 Contact Center.
You can use these APIs in scenarios such as:
- When AI agents need to escalate ongoing conversations to those queues only where service representatives are available.
- You want customers to initiate conversations only when the queues are within operating hours or have available representatives.
The representative availability APIs are applicable for all channels, including voice, live chat, and digital messaging.
Prerequisites
- You have the Omnichannel administrator role assigned.
Set up token for API authorization
To use the representative availability APIs, you must generate an access token. This token acts as a secure credential to authenticate your application's identity and authorize it to access specific service resources.
Do the following steps in the Azure portal:
Register your application or go to Entra ID > App registrations, and then select your client application. Copy the following values:
- Application (client) ID
- Directory (tenant) ID
In your app registration, select API permissions > Add a permission.
In Request API permissions, select Microsoft APIs tab and then select Dynamics CRM.
Select Delegated permissions, and then select the
user_impersonationscope.Select Add permissions.
Important
Copy the secret Value immediately. This value is encrypted and isn't displayed again after you leave the page.
To generate the token, run the following POST request. Replace the following values.
| Value | Description |
|---|---|
tenant-Id |
The Directory (tenant) ID of the app. |
client_id |
The Application (client) ID assigned to your app in Microsoft Entra ID. |
client_secret |
The secret string generated during app registration. |
resource |
The URL of your Dynamics 365 environment, defining the requested permissions. |
curl --request POST \
--url https://login.windows.net/{tenant-Id}/oauth2/token \
--header 'Content-Type: multipart/form-data' \
--header 'User-Agent: insomnia/10.1.0' \
--cookie 'fpc=ApQqO0OrCftGhsPOawVKHv6SxOiUAgAAHN3YN8OAAAA; x-ms-gateway-slice=estsfd; stsservicecookie=estsfd' \
--form grant_type=client_credentials \
--form client_id={ApplicationIdFromAppRegistration} \
--form 'client_secret={secretSavedInPreviousStep}' \
--form resource={OrgUrl}
The response returns a JSON object with the token that you can use in the Authorization Header of your representative availability API calls as a Bearer token.
Representative availability APIs
The following representative availability APIs are available:
- CCaaS_GetRepresentativeAvailabilityForConversation: Returns the queue and service representative availability during an active conversation with a valid conversation ID. Learn more in CCaaS_GetRepresentativeAvailabilityForConversation
- CCaaS_GetRepresentativeAvailabilityBeforeConversation: Returns the queue and service representative availability before a conversation with the customer starts. Learn more in CCaaS_GetRepresentativeAvailabilityBeforeConversation
Related information
CCaaS_GetRepresentativeAvailabilityForConversation
CCaaS_GetRepresentativeAvailabilityBeforeConversation