Creating Event Handling Actions
In this article we will go through the steps required to create an action that allows you to handle events
Objective
In this article we will go through the steps πΆrequired to create an action that allows you to handle events. This can be applied to trigger actions or workflows defined in your Data Processing Engine with a body of data outside of the platform.
Event Handling Table
We usually recommend that when actions are called by an external event, the event call is archived for reference in your project. In this article we will use an example table in our data model called event_handle
- Table Name: event_handle
- Table Description: the table contains 4 attributes to store the content of the event.
Note that the names provided in this example both for the table, its attributes as well as all the other object names below (for the action or functions) are examples. You can obviously choose to name your objects differently, just make sure that you update the subsequent code section which references the different objects.
Generally speaking this is a good best practice to set-up if you're planning on creating custom actions which handle events because you will use it to archive all triggered events. To create such a table, head to the Lakehouse Manager component, create a table with attributes following the ones outlined in the table above.
Creating a data model in the Lakehouse Manager
Event Handling Action Set-up
To create your custom action, head to the Data Processing Engine component and create a new custom action and enter the action name as Event handle. The sample Python code provided below shows how to manage the body of the event when the action is triggered outside of the platform, typically via API endpoint.
In the custom action configuration, change the function name (which specifies which Python function is the main function to run) to event_handle. Finally, copy & paste πΎ the following code sample in the custom code editor:
Note that if you're more confortable in an IDE-like interface, click on the Advanced mode on top of the page to switch to the online code editor. You will be able to update the raw source code of the action in the Python script and all its configuration in the JSON file.
Launching Actions and Workflows
Now that you know how to handle the incoming event information when an action is launched externally, let's look at how to set-up the trigger events. This will enable you to start a job of an action or workflow programmatically.
Required Parameters
There 3 parameters required to launch a job which you obviously need to set with respect to your own environment configuration. All the parameters are outlined in the code samples using {} brackets like {subdomain}.
Project Subdomain
To retrieve your project subdomain, simply look-up your project URL. For instance if you copy paste the URL when you have the DPE component open it should look like this:
The subdomain is the first reference in the path of your project's URL.
Action ID or Workflow ID
To retrieve the action ID of the action you want to start, you can also find it in your action's URL when editing it. To do that, click edit on the action you want to trigger, the URL should look like this:
Authentication Token
To generate an authentication token, you will first need to create a specific API & secret key from the Identity Access Manager component. To learn how to do that, check-out this dedicated article:
Code samples
Note that workflows and actions can be equally triggered using the same process. To use the data sent as part of the call, make sure the workflow contains a handling event action. Also, make sure to use the right URL for workflows (see section on Action or Workflow ID).
We hope this article was useful! Let us know if you have any questions or would like to suggest an improvement.
Go further
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.
Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated Discord channel.
If you need support with your OVHcloud services, create a request in our Help Centre.
Join our community of users.

