0

I am pulling campaign assets using the REST API, similarly to the method described here. However, the emails connected to the campaign are not marked as "type": "EMAIL", but as "type": "CMS_ASSET", with the itemID linking to Content Builder's Asset ID.

What I need to do is to connect the campaign information to specific sends on the job level. In the _Job data view, I have the Content Builder's Email ID available.

What are the possible ways by which I can retrieve the mapping between the Email ID and Asset ID?

3
  • Can you provide some context on this asset type CRM_ASSET as from all documentation, etc. this is not a valid asset type. (developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/…) Now, this is likely something that SFMC has done and not documented or announced, just hoping more context on it will help us better be able to duplicate your situation and find a solution. – Gortonington Sep 10 '20 at 14:48
  • @Gortonington This might have been a bit confusing. That "CMS_ASSET" is actually a type of "campaign asset". So I believe that any time you connect any Content Builder asset to a campaign, it becomes a CMS_ASSET type of "campaign asset", and then it has its own type which is one of these mentioned in the "asset" documentation. Other types of campaign assets are e.g. SMS_MESSAGE or CALENDAR_EVENT – Radek Janhuba Sep 11 '20 at 7:01
  • My issue is that it is not documented, or at least not documented well or anywhere other than a single place that vaguely references it. As with most things SFMC, normalcy and consistency is not common. For instance, they are adding in a 'new' CMS option that interacts with SFMC, so my assumption is this was somehow involved with that. Also, neither campaign asset nor cms_asset are mentioned in the type or asset documentation. The only mention of them is in the link I provided on the below answer. – Gortonington Sep 11 '20 at 12:40
1

I believe the value you're looking is actually called legacyID in the returned payload from the POST /asset/v1/content/assets/query route.

Let's assume you're payload looks like this:

{
    "page":
    {
        "page":1,
        "pageSize":500
    },
    "query":
    {
            "property":"data.campaigns.campaigns.campaignId",
            "simpleOperator":"equal",
            "value":4394

    },
    "fields":
    [
        "data",
        "name"
    ]
}

In response you're going to receive something like this:

{
    "count": 1,
    "page": 1,
    "pageSize": 500,
    "links": {},
    "items": [
        {
            "id": 43210,
            "customerKey": "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEEE",
            "assetType": {
                "id": 321,
                "name": "htmlemail",
                "displayName": "HTML Email"
            },
            "name": "Your Email",
            "data": {
                "campaigns": {
                    "campaigns": [
                        {
                            "campaignId": 1234,
                            "campaignAssociationId": 4321
                        }
                    ]
                },
                "email": {
                    "options": {
                        "characterEncoding": "utf-8"
                    },
                    "legacy": {
                        "legacyId": 1020304,
                        "legacyKey": "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEEE",
                        "legacyType": "email",
                        "legacyCategoryId": 10203
                    }
                }
            },
            "legacyData": {
                "legacyId": 1020304,
                "legacyKey": "5d449885-ac1b-49be-b20d-488d36175f36",
                "legacyType": "email",
                "legacyCategoryId": 10203
            },
            "modelVersion": 2
        }
    ]
}

From here you need to extract the data.legacy.legacyId or legacyData.legacyId properties

7
  • but this is for a type of 'htmlemail' not 'cms_asset' like he has - so not even sure if legacyData would be available. I have honestly not seen this asset type before, nor is it documented - which makes it hard to really find a definitive solution. Also, I believe legacy ID is the 'Email ID' that was assigned for classic content, not the one used in Content Builder. So not sure this would even give the correct info. – Gortonington Sep 10 '20 at 14:46
  • @Gortonington There are two issues here: why OP gets this CMS_assets is one of them, but the core question here is how to match this info Assets with e-mails and I do hope the endpoint I'm showing might help OP since he used a different way of getting assets. As for the LegacyID, I tested this and even new Content Builder emails do contain this id for some reason. – Rafał Wolsztyniak Sep 10 '20 at 19:04
  • 1
    But that is the thing. If it was not the CMS_asset type, then you would not need this step as the ID would be an emailid. The only real issue is figuring out what the CMS_asset type is and why he is getting it for emails. From there we can explore a solution. As far as legacy id, it is on CB emails for sure, but is it there for CMS_asset types? That is where I am saying there is a hole in your solution. – Gortonington Sep 10 '20 at 19:30
  • @Gortonington That's fair, thanks for elaborating. If you're interested, CMS_ASSET is mentioned in the code of the Node SDK: github.com/salesforce-marketingcloud/FuelSDK-Node/pull/14/files – Rafał Wolsztyniak Sep 10 '20 at 20:44
  • Looks like it was in the REST Docs, just hidden. Check out the Description of 'Type' in this link (developer.salesforce.com/docs/…) seems 'CMS_ASSET' refers to all Content Builder assets. As for how this associates with Campaigns and AssetIDs, etc. I am unsure – Gortonington Sep 10 '20 at 21:28

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.