Custom action plugins
A custom action plugin is a plugin that can be associated to a custom action node in an automation, allowing you to trigger a custom action in an automation.
This feature is useful for triggering actions not available in the current list of actions in automations.
If you don't know what a plugin is, you can find complete documentation in the specific section.

Endpoints to implement

Custom action plugins have only one predefined endpoint to implement.
post
myworker
/v1/scenario_custom_actions
Trigger a custom action
See Plugin Instances to learn why you should use the custom_action_id parameter to retrieve the instance properties.

Available outbound services

The code of the custom action plugin can call the following API endpoints to retrieve its instance context.
get
https://api.mediarithmics.com
/v1/scenario_custom_actions/:id
Retrieve the instance
get
https://api.mediarithmics.com
/v1/scenario_custom_actions/:id/properties
Retrieve the instance properties

Creating a custom action plugin

See the plugins documentation to see how plugins are created and deployed.
A custom action plugin has the SCENARIO_CUSTOM_ACTION plugin type. Its group id should be {domain.organisation.scenario-custom-action} (for example com.mediarithmics.scenario-custom-action).
Its artifact id should be the name of the custom action plugin, i.e. example-custom-action.
Use our Plugin SDK to create your custom action plugin in Node.js: the required routes are already defined and you only have to override specific functions.
You can find a sample custom action plugin in the examples folder of the plugin SDK.
We can provide you with a Hello World project using our SDK. Please contact your support to gain access to it.
The project structure and files work as with every other plugin.

Interfaces to implement

You should extend CustomActionBasePlugin class and implement the onCustomActionCall function from the plugin SDK.
The onCustomActionCall function is called every time a user point runs through a custom action node in an automation. It is responsible for implementing the custom action.
Don't forget to catch your errors. You should log / respond with the appropriate message to facilitate debugging.
1
import { core } from '@mediarithmics/plugins-nodejs-sdk';
2
3
export class MyCustomActionPlugin extends core.CustomActionBasePlugin {
4
protected onCustomActionCall(
5
request: core.CustomActionRequest,
6
instanceContext: core.CustomActionBaseInstanceContext
7
): Promise<core.CustomActionPluginResponse> {
8
9
// do stuff here
10
11
const response: core.CustomActionPluginResponse = {
12
status: 'ok',
13
};
14
15
return Promise.resolve(response);
16
}
17
}
Copied!
post
https://api.mediarithmics.com
/v1/scenario_custom_actions
Create a custom action plugin instance
put
https://api.mediarithmics.com
/v1/scenario_custom_actions/:id/properties/technical_name=:name
Update a custom action plugin instance property

Debugging

Plugin logs and metrics

You can monitor custom action plugins as you do with all plugins.