0

We are trying to use Content Builder's Free form block for adding images by uploading them via UI and adding required details. We have a use-case where we need to refer to these added image details like image source link, image redirection link, image alias etc.

Is there any ampscript variable where SFMC stores these values added from the UI and that can be referenced when required?

1 Answer 1

0

The only way to get these values is via the API. As a note though, API calls in general are not a good thing to include inside of any sendable context, so likely best bet would be to run this prior to sends and save it inside of a Data Extension or similar for reference in your emails.

You would use the Simple Query API call matching on the assetID of your image. This would return a JSON payload that you can then use to get the information you need out for that asset.

In order to use the REST API, you will need:

  • a package with an API component
  • an authentication call using info from package
  • AMPscript/SSJS function to make the call
  • Script to run through the returned JSON and collect the info you need

Here is a good walkthrough on setting up the package and making an auth call.

As it is a JSON response, I would highly recommend using SSJS and this article can help you with possible functions to gather this info.

Example JSON response:

{
    "id": 123456,
    "customerKey": "myCustKey",
    "objectID": "00000000-1111-4444-9999-eeeeeeeeeeee",
    "assetType": {
        "id": 28,
        "name": "png",
        "displayName": "Image"
    },
    "fileProperties": {
        "fileName": "deleteme.png",
        "extension": "png",
        "fileSize": 6578,
        "fileCreatedDate": "2022-08-21T09:29:39.1708616-06:00",
        "width": 500,
        "height": 107,
        "publishedURL": "https://image.sX.sfmc-content.com/lib/xxxxxxxxxxxxxxxx/m/1/deleteme.png"
    },
    "name": "deleteme",
    "owner": {
        "id": 8675309,
        "email": "",
        "name": "MyCoolUser",
        "userId": "777555"
    },
    "createdDate": "2022-09-21T09:29:39.17-06:00",
    "createdBy": {
        "id": 8675309,
        "email": "",
        "name": "MyCoolUser",
        "userId": "777555"
    },
    "modifiedDate": "2022-01-21T09:29:39.17-06:00",
    "modifiedBy": {
        "id": 8976856,
        "email": "",
        "name": "MyCoolUser",
        "userId": "777555"
    },
    "enterpriseId": 123456,
    "memberId": 77553311,
    "status": {
        "id": 2,
        "name": "Published"
    },
    "thumbnail": {
        "thumbnailUrl": "/v1/assets/123456/thumbnail"
    },
    "category": {
        "id": 1111,
        "name": "Content Builder",
        "parentId": 0
    },
    "availableViews": [],
    "modelVersion": 2
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .