Mapping activities to programs

Harrison_Van_Oo
Level 1

Mapping activities to programs

Is it possible to tie a Marketo "Activity" to a particular "Program"? For example, by querying the /rest/v1/activities.jsonendpoint, you might receive a response like this within the list of results:

 

{
  "id": 1843265,
  "marketoGUID": "1843265",
  "leadId": 72788,
  "activityDate": "2019-03-01T00:02:36Z",
  "activityTypeId": 100087,
  "primaryAttributeValueId": 17275,
  "primaryAttributeValue": "Email name 123",
  "attributes": [
    {
      "name": "Asset ID",
      "value": 2290
    },
    {
      "name": "Asset Type",
      "value": "Email"
    },
    {
      "name": "Campaign ID",
      "value": 2458
    },
    ...
  ]
}

 

None of the provided IDs in this response seem to be tied to a Program. Am I missing something?

9 REPLIES 9
Jackie_Potts
Level 7 - Champion Alumni

Re: Mapping activities to programs

Program operations are listed under assets - https://developers.marketo.com/rest-api/endpoint-reference/asset-endpoint-reference/. Maybe this will help you get to what you need.

Harrison_Van_Oo
Level 1

Re: Mapping activities to programs

Thank you, Jackie. I would certainly need to use that endpoint as well, but the issue is that the /rest/v1/activities.json endpoint does not provide any program ID that corresponds to the "id" field provided by the /rest/asset/v1/programs.json endpoint (as far as I can tell). This means that I cannot tie an activity to the program it ocurred in.

Is there a field provided in the /rest/v1/activities.json response that does map to Program ID and I'm just missing it? For example, does primaryAttributeValueId refer to the Program ID?

Jackie_Potts
Level 7 - Champion Alumni

Re: Mapping activities to programs

I am not sure. Do either of these help you? If not, maybe another with more experience in this area can help you out.

pastedImage_1.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Mapping activities to programs

The full name of the asset (dotted format) contains the Program Name.

You need to xref that info with the results from the Get Programs tree. Unfortunately, since names are mutable, you run a significant risk of orphaning activities unless you maintain a historical list of the possible names of a program (still won't help with intra-day/intra-sync changes though).

Harrison_Van_Oo
Level 1

Re: Mapping activities to programs

Thank you, Sanford. Although what do you mean exactly by "The full name of the asset (dotted format)"?

In other words, which field in the activities response in my original post refers to the "full name of the asset"?

Harrison_Van_Oo
Level 1

Re: Mapping activities to programs

To clarify my use case, I'm looking to create a table that shows all activities taken along with the associated programs those activities occurred in. For example...

pastedImage_1.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Mapping activities to programs

"My Special Program.Email Number One" == Program Name "My Special Program", Email Name "Email Number One".

Harrison_Van_Oo
Level 1

Re: Mapping activities to programs

Thanks, Sanford. Still not totally getting this. Which field in the activities response in my original post refers to the "full name of the asset" / the Program name?

Jep_Castelein2
Level 10

Re: Mapping activities to programs

Sanford's approach uses the primaryAttributeValue, assuming the Email lives inside the Program and assuming there are no periods in the Program or Email name. You can also consider this approach: https://nation.marketo.com/thread/50537-api-questions-engagement-programs-activity