Marketing Automation Operations API
The Marketing Automation Operations API makes it possible to execute specific operations from outside the Marketing Automation Engine.
Accessing the Automation Operations API
Use the service locator to access IAutomationOperationsClient in a Sitecore context:
Operation results
Each operation accepts a collection of requests. The results of each operation invocation is a batch result. The batch result includes a property to indicate whether the entire batch was successful or whether one or more requests failed. It also holds the individual results for each request:
The type of the result is determined by the operation.
Each individual operation result includes (at minimum) a property indicating whether the operation performed for the request was successful, and the original request. Providing the original request allows linking up the result to the request made from the client.
Operation priority
The Priority property of the request objects determine the processing priority of the request for operations that log the request into the work pool.
The RegisterLiveEvent operation is the only operation which bypasses the pool. Priority is ignored for this operation.
Operations
Enroll contact in plan
Enrolls the provided contact directly into a plan and optionally directly into an activity within the plan. All operations on the operations client are asynchronous and batch requests, even if it is a batch of one.
If the activity is missing from the request, the contact will be put into the entry activity of the plan.
Enrolling a contact in a single plan
The following example demonstrates how to enroll a contact in a single plan.
Enrolling a contact in multiple plans
The following example demonstrates how to enroll a contact in multiple plans at the same time.
Enrollment request results
The following example demonstrates how to get the result of an entire batch of enrollment requests, and how to get additional information about each individual enrollment request.
Register live event
The Operations API allows you to submit an event to the Marketing Automation Engine before that event has been submitted to xConnect. This feature is used by the tracker to submit events to the Marketing Automation Engine before the session has ended and event data has been submitted to xConnect.
Register a single live event
The following example demonstrates how to register a single live event:
Live event request results
The BatchLiveEventRequestResult makes a list of affected enrollments available via the UpdatedEnrollments property.
Purge contact from plan
You can use the Operations API to remove a contact from a specific plan or from all plans.
Purge contact from specific plan
The following example demonstrates how to purge a contact from a specific plan:
Purge contact from all plans
The following example demonstrates how to purge a contact from all plans:
All work items currently in the pool for the contact will be also be removed.