<script runat="server">
Platform.Load("Core", "1");
var url = 'https://{{Rest URL}}/interaction/v1/interactions';
var contentType = 'application/json';
var payload = {
"key": "SSJS-testing-2",
"name": "SSJS Journey",
"description": "We are using this journey to learn how to use the Journey Spec in Journey Builder",
"workflowApiVersion": 1,
"triggers": [
{
"key": "event-key",
"name": "Starting point for the journey",
"type": "Salesforce Data",
"eventDefinitionKey": "APIEvent-c204d5ab-543c-56de-f7f2-75c2f9220311",
"arguments": {},
"configurationArguments": {}
}
]
};
var payloadString = Stringify(payload);
var authorizationHeader = "Bearer " + "{{Token}}"
var headerNames = ["Authorization"];
var headerValues = [authorizationHeader];
var result = HTTP.Post(url, contentType, payloadString, headerNames, headerValues);
Write('Response Status Code: ' + result.StatusCode + '<br>');
Write('Response Content: ' + result.Response);
</script>