How to get contacts within a contactlist

Hi,
I'm trying to create a dialer penetration metric like Count of Unique Attempts / Count of Call List Records. However i can't find the data in the API :

Can you point me to the right method to get the actual contacts within the contact list and then get the number of calls made?

i can see the methods

/api/v2/outbound/contactlists
and
/api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}

But where do I find the contactId to pass into the 2nd method?

thanks.

matthew

You'll want to use https://developer.mypurecloud.com/api/rest/v2/outbound/index.html#postOutboundContactlistsContactlistIdExport to initiate the export and then that will provide the link to download the contact list.

Hi, but then you have to download the file and then import it? the Sheet in the xls file is also getting a id that you need to decipher before you can read from it. Is there no other way of doing this?

correct, contact lists can be pretty large so rather then doing it synchronously and hitting client timeouts and holding on to handles in the public api service, we have to defer to a file download

Do you have an example on how this is done? I get the URI but are struggling with getting the file.

this should sort of work. If trying to run in a browser, downloadUri will redirect and the browser will prevent it due to cors.

var api = new purecloud.platform.OutboundApi(pureCloudSession);

var contactListId = "0dc1022b-8fab-4bf7-ad58-0afec66228ed";
api.getContactlistsContactlistIdExport(contactListId, false)
  .then(function(result){

    var downloadUri = result.uri;

    pureCloudSession.get(downloadUri).then(function(dlResult){
      console.log(dlResult);
    }).catch(function(error){
    console.error(error);
  });
  
    
});

It might work in Java, but I'm using C# in winforms and I'm not able to get this to work, when sending the uri to a browser it stops because of autentication.

do a GET on that downloadUri, it will return back a 303 with a new location. Do another get on that new location and that should return your contact list data

Is it pureCloudSession.get() you are meaning? I cant find this for C# .Net.

Sorry, that's a helper method in the JS sdk. if you do an http request to get the downloaduri, include the Authorization header with your auth token. you can get your auth token from ININ.PureCloudApi.Client.Configuration.Default.AccessToken, but you need to include "bearer" in the header value so

var authHeader = "bearer " + ININ.PureCloudApi.Client.Configuration.Default.AccessToken;

Yes. i had this issue and solved it earlier. This downloads the file in one go :

  WebClient wc = new WebClient();
  wc.Headers.Add("Authorization","bearer " + ININ.PureCloudApi.Client.Configuration.Default.AccessToken);
   wc.DownloadFile(url, fullPathToFile);

That worked fine, thanks.

In the original question the statistic "Count of Unique Attempts" was referenced. Has anyone figured out how to get this metric? If so please elaborate because I'm stumped at this point. Also, "Count of Unique Attempts per Contact". I've gone through the ContactList export process and gotten the file but it doesn't have this data.

The contact list doesn't contain attempts other than the last attempt. If you need to find detailed data, use segment filters in an analytics conversation detail query to filter on outboundCampaignId, outboundContactId, or outboundContactListId. A query to POST /api/v2/analytics/conversations/details/query might look like:

{
 "interval": "2017-03-15T18:07:59.000Z/2017-03-18T18:12:59.000Z",
 "order": "asc",
 "orderBy": "conversationStart",
 "paging": {
  "pageSize": 25,
  "pageNumber": 1
 },
 "segmentFilters": [
  {
   "type": "or",
   "predicates": [
    {
     "type": "dimension",
     "dimension": "outboundCampaignId",
     "operator": "matches",
     "value": "86b62839-32e6-4e27-b6c1-5dfab122c389"
    }
   ]
  }
 ]
}

This query gives conversation detail records for a given contact list. Would I then have to query the results a step further, grouping by outboundContactId to get the number of attempts?

Using the conversation aggregates query I get this.

{
  "interval": "2017-01-02T05:00:00.000Z/2017-01-07T05:00:00.000Z",
  "groupBy": [
    "outboundContactId"
  ],
  "metrics": [
    "nOutboundAttempted",
    "nOutboundConnected"
  ]
}

This is what my results look like.

"results": [
{
  "group": {
    "mediaType": "voice",
    "outboundContactId": "9375509836"
  },
  "data": [
    {
      "interval": "2017-01-02T05:00:00.000Z/2017-01-07T05:00:00.000Z",
      "metrics": [
        {
          "metric": "nOutboundAttempted",
          "stats": {
            "count": 2
          }
        }
      ]
    }
  ]
 }
]

Would the "count" stat be a count of calls attempted to that contact? If so, what is the difference between attempted and connected? Are they mutually exclusive or could a connect also count as an attempt and visa versa?

The metric definitions are documented here: https://developer.mypurecloud.com/api/rest/v2/analytics/metrics.html

In your results, contact ID 9375509836 was attempted twice in the interval specified in your query.

I am trying to get the export CSV result, using a CURL GET (in PHP). I use the very same auth that I use to perform all other actions through the API. However, when I try to download the contents of the report, I get the following message:

<Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message>

Any suggestion?

See this thread: https://developer.mypurecloud.com/forum/t/read-contactlist-as-stream/1220/2

It explains everything. My download is working now.
Thank you!