2

I am currently looking to extract the number of contacts who went through different activities of a journey. Is there a way I can extract this information through API?

3

To gather history, you can use the following rest endpoint: {{endPoint}}/interaction/v1/interactions/journeyhistory/search?$page=1&$pageSize=6000

Please note that if you do not put ?$page=1&$pageSize=XXX the API will default to a page size of 50. for instance if you just do ?$pageSize=6000 it will still only display 50. (Not sure why, likely a bug since it is undocumented).

This will return a JSON array of contacts associated with each journey. Do note though, this appears to only go back 30 days.

I have a blog post here that may help give more details on it.

Example function to pull journey history:

function journeyHistoryReturn(authToken,endPointURL,page,pageSize) {
    var endPoint = endPointURL + '/interaction/v1/interactions/journeyhistory/search?$page=' + page + '&$pageSize=' + pageSize;
    var contentType = 'application/json';
    var payload = '';
    var headers = ['Authorization'];
    var headervalues = [authToken];

    var results = HTTP.Post(endPoint, contentType, payload, headers, headervalues);


    return results.Response;
}
1
  • Thanks @Gortonington! It really helped me a lot. Sep 9 '19 at 15:04
0

That information is not available via API. What I typically do is to create a custom activity (https://developer.salesforce.com/docs/atlas.en-us.mc-app-development.meta/mc-app-development/creating-activities.htm) that just writes to a data extension and use it as a log of the trace of the different paths.

7
  • Thanks Javier! It shouldn't be this tough :) Sep 4 '19 at 13:01
  • 2
    To gather history, you can use the following rest endpoint {{endPoint}}/interaction/v1/interactions/journeyhistory/search?$page=1&$pageSize=6000 where pageSize is your max number of contacts. This will return a JSON array of contacts associated with each journey. Do note though, this appears to only go back 30 days. Sep 4 '19 at 13:56
  • 2
    No it is undocumented Sep 5 '19 at 11:09
  • 1
    @AnonWonderer that is a good point, and in many cases Update Contact will be enough. But, Update Contact updates the record if it founds the contact key in the table, and if you have any kind of re-entry policy, you would lose the logging behavior in the sense that you would have 2 moments in which the contact went through the activity but only 1 record in the table. Sep 5 '19 at 15:06
  • 1
    @Gortonington, could you add your comment about the journey history api endpoint as answer? I will mark it as correct answer. It works for me. thanks. Sep 9 '19 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.