Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Bulk Recordings Export

    Posted 12-03-2024 10:47
    No replies, thread closed.

    Hi,

    We are using the Bulk recording API to export/download recordings since 2022. The recordings are getting exported to the S3 but the issue here is, in the Genesys UI for month of December, 2022 we see 2428 interactions/recordings but the interactions/recordings exported to S3 are 1984, there are 444 interactions/recordings that did not export to S3 and this happening for every month for which we are exporting. Through the API we do not have a way to find out which recordings did export. We did run the Job multiple times but the count is still the same (1984).

    1. Is there any reason why we some recordings are failing to export?
    2. Is there a way to track to which recordings failed to export and jut try to export the failed ones.
    3. Below after running the job, we are not able to figure out how to calculate:
      1. Total number of recordings
      2. Total failed 
      3. Total exported

    ********************************************************************************************************************************************************

    const platformClient = require('purecloud-platform-client-v2');
    const client = platformClient.ApiClient.instance;
     
    // Globals
    let newJob = null;
     
    // Get client credentials from environment variables
    // Get client credentials from environment variables
    const CLIENT_ID = "xxxxxxxxxx-xxxxxxxx-xxxxxxx-xxxxxxx25a69";
    const CLIENT_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    const ORG_REGION = "us-east-1"; // eg. x
     
    // Set environment
    const environment = platformClient.PureCloudRegionHosts[ORG_REGION];
    if(environment) client.setEnvironment(environment);
     
    // API Instances
    const recordingApi = new platformClient.RecordingApi();
     
    client.loginClientCredentialsGrant(CLIENT_ID, CLIENT_SECRET)
     
    .then(()=> {
        //return getRecordingJobs();
        return createRecordingBulkJob();
    })
    .then((job) => {
    console.log('Succesfully created recording bulk job');
     
    newJob = job;
    return waitOnJobProcessing(newJob.id);
    })
    .then(() => {
    console.log('Job is now ready: ' + newJob.id);
     
    return executeJob(newJob.id);
    })
    .then(() => {
    console.log('Succesfully execute recording bulk job');
     
    //return recordingApi.deleteRecordingJob(newJob.id);
    return getRecordingJobs();
    })
    // //.then(() => {
    //     //console.log('Succesfully cancelled recording bulk job');
     
     
    //     //return getRecordingJobs();
    // //})
    .then((result) => {
        console.log(result);
     
        console.log('Succesfully get recording bulk jobs')
    })
    .catch((err) => {
        console.log(err);
    });
     
    function createRecordingBulkJob(){
        return recordingApi.postRecordingJobs({
            action: 'EXPORT', // set to "EXPORT" for export action
            actiondate:'2024-11-30T00:00:00.000Z',
            actionAge: 0,
            integrationId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // Only required when action is EXPORT
            includeScreenRecordings: false,
            conversationQuery: {
               
               interval: '2023-02-01T00:00:00.000Z/2023-02-28T23:59:00.000Z',
               
           
                order: 'asc',
                orderBy: 'conversationStart'
            }
        })
    }
     
     
    function waitOnJobProcessing(id){
        // Initial state of job is PROCESSING
        // Wait every 2sec until job has READY state
        return new Promise((resolve, reject) => {
            let timer = setInterval(() => {
                recordingApi.getRecordingJob(id)
                .then((jobStatus) => {
                    console.log(`State is ${jobStatus.state}.`)
                    if(jobStatus.state == 'READY') {
                        resolve();
                        clearInterval(timer);
                    }
                })
                .catch((e) => reject(e));
            }, 2000);
        });
    }
     
     
    function executeJob(id){
        return recordingApi.putRecordingJob(id, {
            state: 'PROCESSING'
        });
    }
     
     
    function getRecordingJobs(){
        return recordingApi.getRecordingJobs({
            pageSize: 100,
            pageNumber: 1,
            sortBy: 'dateCreated', // or 'dateCreated'
            state: 'FULFILLED', // valid values FULFILLED, PENDING, READY, PROCESSING, CANCELLED, FAILED
            showOnlyMyJobs: true,
            jobType: 'EXPORT' // or 'DELETE' or 'ARCHIVE'
        })
    }

    ************************************************************************************************************************************

    OUTPUT

    > npm start
     
    > node  index.js
     
    Succesfully created recording bulk job
    State is PENDING.
    State is PENDING.
    State is PENDING.
    State is PENDING.
    State is PENDING.
    State is PENDING.
    State is PENDING.
    State is READY.
    Job is now ready: 2e200a9f-62c4-4aca-8239-1ee2846178c2
    Succesfully execute recording bulk job
    {
      entities: [
        {
          id: 'fa62434a-872d-48d7-9525-587af5a95f9b',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-03T08:44:08.566Z',
          totalConversations: 38758,
          totalRecordings: 15593,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 13845,
          totalProcessedRecordings: 15593,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/fa62434a-872d-48d7-9525-587af5a95f9b/failedrecordings',
          selfUri: '/api/v2/recording/jobs/fa62434a-872d-48d7-9525-587af5a95f9b',
          user: [Object]
        },
        {
          id: '39195f55-52bc-4932-9d00-9124d729aca3',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-03T05:49:17.762Z',
          totalConversations: 25929,
          totalRecordings: 8729,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 6745,
          totalProcessedRecordings: 8729,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/39195f55-52bc-4932-9d00-9124d729aca3/failedrecordings',
          selfUri: '/api/v2/recording/jobs/39195f55-52bc-4932-9d00-9124d729aca3',
          user: [Object]
        },
        {
          id: '82d73137-7b15-4e4f-9a7e-7cf56f5c2d03',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-03T05:40:02.881Z',
          totalConversations: 25929,
          totalRecordings: 8729,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 6745,
          totalProcessedRecordings: 8729,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/82d73137-7b15-4e4f-9a7e-7cf56f5c2d03/failedrecordings',
          selfUri: '/api/v2/recording/jobs/82d73137-7b15-4e4f-9a7e-7cf56f5c2d03',
          user: [Object]
        },
        {
          id: '89ef6419-c4d6-4196-a522-50cd2871c182',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-02T17:31:29.461Z',
          totalConversations: 21931,
          totalRecordings: 2687,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 2227,
          totalProcessedRecordings: 2687,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/89ef6419-c4d6-4196-a522-50cd2871c182/failedrecordings',
          selfUri: '/api/v2/recording/jobs/89ef6419-c4d6-4196-a522-50cd2871c182',
          user: [Object]
        },
        {
          id: '827af2bd-8985-48e1-baaa-aa93f966df95',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-02T17:09:34.337Z',
          totalConversations: 21931,
          totalRecordings: 2757,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 2227,
          totalProcessedRecordings: 2757,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/827af2bd-8985-48e1-baaa-aa93f966df95/failedrecordings',
          selfUri: '/api/v2/recording/jobs/827af2bd-8985-48e1-baaa-aa93f966df95',
          user: [Object]
        },
        {
          id: '22695833-bc8f-421f-b91f-e6dd6f1326f1',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-02T09:56:10.223Z',
          totalConversations: 6026,
          totalRecordings: 763,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 760,
          totalProcessedRecordings: 763,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/22695833-bc8f-421f-b91f-e6dd6f1326f1/failedrecordings',
          selfUri: '/api/v2/recording/jobs/22695833-bc8f-421f-b91f-e6dd6f1326f1',
          user: [Object]
        },
        {
          id: '131f91db-2c15-4d1d-8491-81f868abbe20',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-02T02:26:08.767Z',
          totalConversations: 65,
          totalRecordings: 64,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 55,
          totalProcessedRecordings: 64,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/131f91db-2c15-4d1d-8491-81f868abbe20/failedrecordings',
          selfUri: '/api/v2/recording/jobs/131f91db-2c15-4d1d-8491-81f868abbe20',
          user: [Object]
        },
        {
          id: '443a211c-2d94-454c-a4ef-c67a75cd54d7',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-02T02:21:08.448Z',
          totalConversations: 65,
          totalRecordings: 64,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 55,
          totalProcessedRecordings: 64,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/443a211c-2d94-454c-a4ef-c67a75cd54d7/failedrecordings',
          selfUri: '/api/v2/recording/jobs/443a211c-2d94-454c-a4ef-c67a75cd54d7',
          user: [Object]
        },
        {
          id: '0037ac70-a18e-42dc-8ccf-64f90ed99d83',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-01T20:37:26.698Z',
          totalConversations: 128,
          totalRecordings: 123,
          totalSkippedRecordings: 0,
          totalFailedRecordings: 74,
          totalProcessedRecordings: 123,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/0037ac70-a18e-42dc-8ccf-64f90ed99d83/failedrecordings',
          selfUri: '/api/v2/recording/jobs/0037ac70-a18e-42dc-8ccf-64f90ed99d83',
          user: [Object]
        },
        {
          id: '8c8c0596-1650-4404-9e27-ae6a74d6adfb',
          state: 'FULFILLED',
          recordingJobsQuery: [Object],
          dateCreated: '2024-12-01T11:40:04.120Z',
          totalConversations: 106028,
          totalRecordings: 63120,
          totalSkippedRecordings: 13,
          totalFailedRecordings: 58909,
          totalProcessedRecordings: 63107,
          percentProgress: 100,
          failedRecordings: '/api/v2/recording/jobs/8c8c0596-1650-4404-9e27-ae6a74d6adfb/failedrecordings',
          selfUri: '/api/v2/recording/jobs/8c8c0596-1650-4404-9e27-ae6a74d6adfb',
          user: [Object]
        }
      ],
      pageSize: 100,
      pageNumber: 1,
      total: 10,
      lastUri: '/api/v2/recording/jobs?pageSize=100&pageNumber=1&sortBy=dateCreated&state=FULFILLED&jobType=EXPORT&showOnlyMyJobs=true',
      firstUri: '/api/v2/recording/jobs?pageSize=100&pageNumber=1&sortBy=dateCreated&state=FULFILLED&jobType=EXPORT&showOnlyMyJobs=true',
      selfUri: '/api/v2/recording/jobs?pageSize=100&pageNumber=1&sortBy=dateCreated&state=FULFILLED&jobType=EXPORT&showOnlyMyJobs=true',
      pageCount: 1
    }
    Succesfully get recording bulk jobs
    Thank You

    #API/Integrations

    ------------------------------
    Praveen Kumar
    Technical Consultant
    ------------------------------


  • 2.  RE: Bulk Recordings Export
    Best Answer

    Posted 12-03-2024 16:26
    No replies, thread closed.

    Hello Praveen,

    For your count discrepancy, there could be recordings that may have been deleted due to retention policies. You may want to check out the Developer Forum and ask your questions there.



    ------------------------------
    Jason Kleitz
    Online Community Manager/Moderator
    ------------------------------