Skip to content

Instantly share code, notes, and snippets.

@zuzannamj
Last active April 6, 2020 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zuzannamj/1feb2505c8c83959862ba5d0023ce2a2 to your computer and use it in GitHub Desktop.
Save zuzannamj/1feb2505c8c83959862ba5d0023ce2a2 to your computer and use it in GitHub Desktop.
//make api call to inject contact to a journey
if (email != null && accessToken != null) {
var email = Request.GetQueryStringParameter("email");
var headerNames = ["Authorization"];
var headerValues = ["Bearer " + accessToken];
var jsonBody = {
"ContactKey": email,
"EventDefinitionKey": "APIEvent-xxxxxx", //provide journey EVENT DEFINITION KEY
"Data": {
"email_field": email
}
};
var requestUrl = rest_instance_url + "/interaction/v1/events";
var fireEntryEvent = HTTP.Post(requestUrl, contentType, Stringify(jsonBody), headerNames, headerValues);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment