1

I am trying to create a cloud page in which when I enter any journeys name with the click of a button I should get the name of all the emails used with that Journey.

Some of these journeys in my account have over 20-30 emails and we’re constantly looking at the journey to see what the latest email in the journeys are.

Is there any way that we can get the data of the emails(Email name) used in the required journey?

1
  • Please update your question to include the code from your CloudPage. Feb 17 '21 at 11:18
2

If you are able to use the REST API, you should be able to collect this information through the following endpoint:

GET /interaction/v1/interactions/{{journeyId}}
Host: {{mySubDomain}}.rest.marketingcloudapis.com
Content-Type: application/json
Authorization: Bearer {{authToken}} 

This endpoint will return all the activities and other correlating information on your specified journey. Here is a link to the official docs. Do note that by default it will return the most recent version of the journey, but if you need a specific version, you can also declare that in a parameter of the URL to correctly adjust your response.

This is an abridged version (use ... to symbolize other data points that I removed) of the JSON response from this endpoint:

{
  "items": [
    {
      "id": "unique-UUID-provided-by-SFMC",
      "key": "a-key-that-is-unique-for-MID",
      "name": "5 days gone by",
      ...,
      "activities": [
        {
          "id": "unique-UUID-provided-by-SFMC",
          "key": "WAIT-2",
          "name": "",
          "description": "",
          "type": "WAIT",
          "arguments": {},
          "configurationArguments": {
            "waitDuration": 1,
            "waitUnit": "DAYS"
          },
          "metaData": {
            "waitType": "duration"
          },
          "schema": {
            "arguments": {
              ...
            }
          }
        },
        {
          "id": "unique-UUID-provided-by-SFMC",
          "key": "EMAILV2-1",
          "name": "FunRun_Email",
          "description": "",
          "type": "EMAILV2",
          "arguments": {},
          "configurationArguments": {},
          "metaData": {},
          "schema": {
              ...
            }
          }
        }
      ],
      "triggers": [],
      "goals": [],
      "tags": [
          {"name": "Fun Run"},
          {"name": "5K"}
      ],
      "stats": {
        ...
      },
      "entryMode": "SingleEntryAcrossAllVersions",
      "defaults": {
        "email": [
          ""
        ]
      },
      "executionMode": "Production",
      "status": "Draft",
      "definitionId": "unique-UUID-provided-by-SFMC"
    }
  ]
}

The important part for you to concentrate on to get the Email names is the activities array. Inside this it has an object for each activity. Inside these objects, you can find the type of activity (e.g. EMAILV2) and the name (e.g. FunRun_Email) of the activity.

By iterating through this array, you should be able to gather all the information you need per journey.

If you are new to API calls, I would recommend checking out this blog post (gives basics on setting up an API environment in SFMC) and then this post which can help give insight into how to make API calls inside of SFMC via SSJS.

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.