Edit

Use representative availability APIs

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:

  1. 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
  2. In your app registration, select API permissions > Add a permission.

  3. In Request API permissions, select Microsoft APIs tab and then select Dynamics CRM.

  4. Select Delegated permissions, and then select the user_impersonation scope.

  5. Select Add permissions.

  6. Add a client secret for your application.

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
CCaaS_GetRepresentativeAvailabilityBeforeConversation