SFMC opening data extensions

Jake Borromeo
Feb 28, 2023

--

<script runat="server">
Platform.Load("core","1.1.5");

var url = "https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com/interaction/v1/interactions/YOUR_JOURNEY_ID/history";
var auth = {
"ClientId": "YOUR_CLIENT_ID",
"ClientSecret": "YOUR_CLIENT_SECRET",
"RefreshToken": "YOUR_REFRESH_TOKEN"
};
var payload = {
"startDate": new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString(),
"endDate": new Date().toISOString(),
"attributes": ["EventDate","ContactKey","ContactID","InteractionID","ActivityID","DefinitionID","DefinitionKey","EventType","BatchID","SubscriberKey","IsInsideFilter","PathID","VersionNumber","Duration","DeviceID","Channel"],
"pageSize": 1000,
"pageNumber": 1
};

var response = HTTP.Post(url, 'application/json', Stringify(payload), auth);

if (response.StatusCode == 200) {
var results = Platform.Function.ParseJSON(response.Response[0]);
// Do something with the results, like display them on a CloudPage
} else {
// Handle error
}
</script>

--

--

No responses yet