Marketing Automation API for Commerce campaigns

Current version: 10.1

The Automation Provider is generic for all marketing automation campaigns and encompasses the following functionality:

  • Creation of a Abandoned Cart marketing automation campaign based on an existing template.

  • Creation of a New Order Placed marketing automation campaign based on an existing template.

  • Contact enrollment into automation campaigns.

  • Contact removal from automation campaigns.

The following class diagram shows the relationship between the IAutomationProvider and the AutomationProvider and lists the methods they contain.

Methods

The table below lists the methods available for the Automation Provider.

Method

Description

CreateFromTemplate

Creates a marketing automation campaign based on a template.

shopName represents the name of the storefront the campaign is being created for. templateName is the name of the template that is used to create the plan.

The resulting campaign name is: shopName + “ “ + templateName.

Important

For Commerce marketing automation campaigns, you must adhere to the naming convention shopName + “ “ + templateName.

EnrollCurrentContact

Enrolls the current contact into the plan.

shopName and basePlanName are concatenated to form the name of the plan to be retrieved via the IAutomationPlanProvider.

customValues represent values that are stored along with the contact in the automation campaign.

This method is called, for example, whenever a contact interacts with the cart on the shopping site to enroll them into Commerce marketing automation campaigns.

RemoveContactFromPlan

Removes the contact from the current plan. For example, when the shopping cart is submitted and turned into an order, this method is called to remove the contact from the abandoned cart campaign.

RemoveCurrentContactFromPlan

Removes the current contact from the given plan.

The default implementation is dynamically loaded based on the following configuration.

RequestResponse
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>

    <automationProvider type="Sitecore.Commerce.MarketingAutomation.Providers.AutomationProvider, Sitecore.Commerce.Connect.MarketingAutomation" singleInstance="true"/>

  </sitecore>
</configuration>

To extend the current implementation, you can implement the IAutomationProvider interface and change the above configuration.

Automation Plan Provider

The Automation Plan Provider is responsible for returning the plan for the current storefront:

The following table details the methods available.

Method

Description

GetPlan

Returns the automation plan based on the given shopName and basePlanName. The default implementation simply concatenates shopName and basePlanName and returns the plan matching that name.  If none is found, null is returned.

The default implementation is dynamically loaded based on the following configuration.

RequestResponse
Sitecore.Commerce.MarketingAutomation.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>

    <automationPlanProvider type="Sitecore.Commerce.MarketingAutomation.Providers.AutomationPlanProvider, Sitecore.Commerce.Connect.MarketingAutomation" singleInstance="true"/>

  </sitecore>
</configuration>

To extend the current implementation, you can implement the IAutomationPlanProvider interface and change the above configuration.

Automation Plan Custom Value Providers

These Custom Value providers deliver additional information that is part of the campaign state when enrolled into a plan.  Currently, a version for Cart and Orders are available. These are the values passed into the customValues of the EnrollCurrentContact method of the IAutomationProvider interface.

The following table lists the methods available.

Method

Description

GetCustomValues

The arguments of the called pipeline are passed as an input parameter to the method. For carts, by default, the following information is returned:

  • External Id

  • Shop name

  • Serialized cart

For orders, by default, the following information is returned:

  • Order Id

  • External Id

The Send Commerce Email marketing automation campaign activity uses the custom values to pass information to the email rendering so that the rendering can extract cart information to be part of the marketing automation campaign email.

Important

For Commerce marketing automation campaigns, do not use the Send Email action.

Do you have some feedback for us?

If you have suggestions for improving this article,