There are several components that go into creating an Activity Type. Once you have the code implemented, you need to ensure the rest of the system is configured to make use of your new code.
Step 1: IActivity implementation
Create a class which implements the IActivity interface. This class should have the logic you want to implement as an action or listener and should return a result that the engine can process. You can return a “Default” path, which is typical for most actions, or “true/false” paths which is typical of listeners and decision points. You cannot define custom paths.
Step 2: Activity Description in Sitecore
Your new implementation class needs an associated item in the Sitecore tree (/sitecore/system/Settings/Analytics/Marketing Automation/Activity Types). When you create it, make sure to specify the Implementation Type field as the full .NET type of your new IActivity implementation.
If you have parameters in your constructor, you need to define them in Sitecore as well. You need matching Paths defined as well.
Step 3: Add an activity type to the Marketing Automation UI
To work in the new Angular SPEAK 3 interface, an NPM project is required and it needs to be installed in the Marketing Automation application. The Marketing Automation does not come with an Angular JiT compiler therefore you need to configure an Angular AoT compiler to prepare your package. Once the plugin is deployed, it needs to be registered with a patch include file with the relative path for the plugin.
Path looks like this: Angular Plugin => {webroot}\Sitecore\shell\client\Applications\MarketingAutomation\plugins
See the detailed documentation: https://doc.sitecore.net/developers/xp/marketing-automation/activities/activity-types/add-activity-type-to-ui.html
Step 4: Marketing Automation Engine configuration
There are three things that need to be configured in the Marketing Automation Engine:
- IActivity implementation type
- Dependent services
- Required facets
For the implementation type, we need to have an XML file in the marketing automation engine folder that defines the class and any options. The DLL also needs to be deployed to the Marketing Automation engine root.
If your activity has any external services that it consumes, these also need to be registered in the automation engine in a separate XML file. You don’t have to do this if you do not have custom services. The DLL with the services also needs to be deployed to the engine root.
If there are any facets that are used by the activity, the ContactLoader configuration file needs to be updated to include the required facets.