Genesys Cloud - Main

 View Only


Discussion Thread View
  • 1.  Get all waiting interactions in a queue through API

    Posted 5 days ago

    Hello team,

    I have a requirement to fetch all the conversations in a queue through API. the queue is a test queue and has not been is use for quite a while. there are 170 interactions waiting which we want to disconnect. However the code is returning only few interactions and if we increase the time duration, it says API can not retrieve data older than 30 days. can you please help.

    const platformClient = require('purecloud-platform-client-v2');
    const client = platformClient.ApiClient.instance;

    // Set environment
    client.setEnvironment(<purecloud domain>);

    // Login using Client Credentials Grant
    client.loginClientCredentialsGrant(Client ID, Client secret)
      .then(() => {
        // Initialize Analytics API
        let apiInstance = new platformClient.AnalyticsApi();
       
        let body = {
          interval: "2024-06-01T00:00:00.000Z/2024-06-23T23:59:59.999Z", // Interval for which data is requested
          order: "asc", 
          orderBy: "conversationStart", 
          paging: {
            pageSize: 100
            pageNumber: 1
          },
          segmentFilters: [
            {
              type: "and",
              predicates: [
                {
                  type: "dimension",
                  dimension: "queueId",
                  operator: "matches",
                  value: "0313b38f-58f5-4fcb-b324-4a66837a9a86"
                },
                {
                  type: "dimension",
                  dimension: "segmentType",
                  operator: "matches",
                  value: "interact"
                },
                {
                  type: "dimension",
                  dimension: "purpose",
                  operator: "matches" ,
                  value: "acd"
                }
              ]
            }
          ]
        };
        return apiInstance.postAnalyticsConversationsDetailsQuery(body);
      })
      .then((data) => {
        console.log(`get conversations data success! Data: ${JSON.stringify(data, null, 2)}`);
      })
      .catch((err) => {
        console.log('There was a failure calling postAnalyticsConversationsDetailsQuery');
        console.error('Error details:', JSON.stringify(err, null, 2));
      });

    #Reporting/Analytics

    ------------------------------
    Swarup Das
    Accenture Solutions Private Limited
    ------------------------------


  • 2.  RE: Get all waiting interactions in a queue through API

    Top 25 Contributor
    Posted 4 days ago

    Hi Swarup,

    Any code questions I would post to the developer forum.

    However have you considered using the aggregate query instead of the detail one?

    Detail API generally has limitation on how many days worth of data you can retrieve at once. 

    If all you need is the Conversation you can grab that from the aggregate query with setting group by conversationId.

    Aggregate query usually has much longer durations you can search for too.



    ------------------------------
    Anton Vroon
    ------------------------------



  • 3.  RE: Get all waiting interactions in a queue through API

    GENESYS
    Posted 4 days ago

    Hello Swarup!  My recommendation would be to use the activity API.  

    /api/v2/analytics/conversations/activity/query

    https://developer.genesys.cloud/analyticsdatamanagement/analytics/analytics-apis

    You would want to query for the details for the oWaiting metric.  That will net you the conversations waiting in queue.  The details endpoint is more for historical record searching, it's not the ideal choice for pulling conversations in realtime.

    As Anton noted, a better place for this type of question is the developer forum.



    ------------------------------
    Ryan Legner
    Staff Product Manager, Genesys Cloud CX
    ------------------------------



  • 4.  RE: Get all waiting interactions in a queue through API

    Posted 4 days ago

    Totally agree with Anton and Ryan that this is a question for developer forum. However, noticed something in Swarup's post that I would like to comment on. 

    Swarup, you can retrieve historical data older than 30 days using this API. Please note, the search interval you specify as part of your query does not exceed 31 days.



    ------------------------------
    Tatjana Knezevic

    www.startelecom.cloud

    https://www.linkedin.com/company/star-telecom-www-startelecom-ca-/
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources