csvcalllogringcentral

Ways to export RingCentral call log as CSV


Call log record can be obtain using RingCentral API and can be filtered using date To (dateTo) and From (dateFrom).

I have went through the API Reference to get call log with API here.

We can see the following API is used to get all the call log record:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/call-log

But we need to export this log something in CSV format file. What is the way we can do it in a file and save it on local disc?

I haven't got that in any official docs.


Solution

  • There are many ways to do it. If you check this reference here you will see, it is suggested to log into RingCentral Online Account Portal (https://service.ringcentral.com) as an admin view your Call Log data, and download each page into one single csv.

    Another reference here suggest to use a programming language to call the call log API and save it as local file.

    example, with Node JS and can run it locally on your machine . All you need to do is need to login the developer portal and create an app with the read call log permission. App platform type will be Server only (no UI). Client ID and Client Secret can be used in the sample code in the link given.

    code snippet:

    platform.get('/account/~/extension/~/call-log', params)
    .then(function(resp){
    var json = resp.json()
      if (json.records.length > 0){
        var fs = require('fs')
          var cvs = 'uri,startTime,duration,type,direction,action,result,to_name,from_name,transport'
          for (var record of json.records){
            //console.log(JSON.stringify(record))
            cvs += "\r\n"
           cvs += record.uri + ','
           cvs += record.startTime + ','
            cvs += record.duration + ','
            cvs += record.type + ','
          cvs += record.direction + ','
          cvs += record.action + ','
           cvs += record.result + ','
            if (record.to.hasOwnProperty('name'))
              cvs += record.to.name + ','
           else
             cvs += 'null,'
          if (record.hasOwnProperty('from')){
             if (record.from.hasOwnProperty('name'))
                cvs += record.from.name + ','
              else
                cvs += 'null,'
           }else
           cvs += 'null,'
           cvs += record.transport