Skip to main content

Celonis Product Documentation

Forward Parameters to Machine Learning Script
Introduction

In order to use the full power of Machine Learning Scripts in combination with Action Flows, the forwarding of parameters is essential. That's the reason we provide you with an Action Flow Snippet that integrates desired parameter of the Action Flow into the ML tool automatically. If you want to know more on how to build useful Machine Learning Scripts have a look here.

Follow the step-by-step guide below to implement this solution for your Celonis Action Flows snippet.

Sample Action Flow

The image below shows an Action Flow snippet which:

  1. Creates JSON data structure to forward parameters

  2. Trigger ML script with parameters

60362991.png
Configuring Action Flow

Below you will find the step-by-step guide for configuring each module of the above Action Flow.

0. Trigger the Action Flow

Note

You can integrate any trigger sequence, e.g. Slack, Email, Celonis, etc.

An example for a Slack trigger sequence can be found at Trigger Machine Learning Script.

60362997.png
1. Customize Variables

This is the most important module in this Action Flow where we have to adjust all the data specific to your team and account like the team domain or an Application Key with the right permissions

60361485.png

Configuration:

Action Flows Module: Tools

Action: Set multiple variables

teamDomain: enter your teamdomain, e.g. demo-action-flows

env: enter your cluster, e.g. try, eu-1...

AppKey: e.g.:

GjV6ODBvghgv6r76r0YzkyLTkxZwjbflqjwhebfljwhebfqjhebfwlV5TEVCcjMzAHBFK0F8TXdGBTlqBWFlsVPN

(create Application Key → Navigate to Permissions → Select Machine Learning Permissions → Enable Use all Machine Learning Apps for your AppKey)

notebookId: we will add this one at a later point in this Template when creating a ML App / adding Scripts to an existing ML App

executionFileName: the name of the ML Script to be triggered, e.g. trigger_MLScript.ipynb

60361487.png
2. Pass Parameters as JSON

This module creates a JSON that is sent as a variable in the HTML request body to be used in our ML script.

60362703.png

Configuration:

Action Flows Module: JSON

Action: Create JSON

Parameters, e.g.:

JSON file for Generator

{
  "parameter1": "test1",
  "parameter2": "test2",
  "parameter3": "test3"
}

Possible Data Types

You can pass any parameters of any type that can be handled by standard python or libraries, e.g. HTML, JSON, str, int, csv-files, txt-files etc.

60362705.png
3. Trigger ML Script

This module sends a POST Request to our ML API and triggers the previously defined ML script.

You do not have to change anything in this module!

60361490.png

Configuration:

Action Flows Module: HTTP

Action: Make a Request

URL: https://{{teamDomain}}.{{env}}.celonis.cloud/machine-learning/api/executions

Method: POST

Headers:

  • Name: Authorization

  • Value: AppKey {{AppKey}}

Body type: Raw

Content type: JSON (application/json)

Request content:

{
"notebookId": "{{notebookId}}",
"executionFileName":"{{executionFileName}}",
"params": {{json}}
}
60362707.png
ML Script: Adding a ML Script to Trigger

Import the script in a new or existing ML App. The ML script will run your pre-defined Python logic and can make use of the parameters that you have forwarded.

Creating your own Logic

The script includes further documentation on how to ensure the successful execution. Please make sure to follow these steps as well.

If you apply your own logic and parameters, please make sure to code robustly and test the script thoroughly. If an error occurs, the backend does not give an indicator what the error was.

1. Navigate to Machine Learning Tab

60361493.png

2. Open existing App or create a new one

60361491.png

Delay

When creating a new ML App it can take a while (minutes to one hour) until you can open it.

3. Import the Script provided above

60361492.png

4. Make sure it is uploaded successfully and displayed in the section on the left

60361499.png

5. Copy the notebookId to the clipboard and add it to the variables as value for the notebookId in the module 'Customize Variables' in the Triggering Action Flow

60361513.png
60361487.png

Mandatory Step for Parameters

When developing your Python code, you can define default values for the parameters to run the script by itself and test your logic.

IMPORTANT Tag the cell of your Notebook with the Tag "parameters" where you set your default values with the same data type that you will pass from the Action Flow. While developing and running the code from Jupyter, these values will be used. When you are calling the Notebook from the Action Flow, the default values will be overwritten by the ones passed by the Action Flow.

60362921.png
Download Action Flows Blueprint

You can download the blueprints of the Action Flows defined in this Help Page here:

These blueprints can be imported into your Celonis EMS Team so that you can quickly make the required changes without needing to build the Action Flows from scratch.

Potential Enhancements

You could integrate other apps into the Action Flow Snippet to forward parameters with data from Celonis, Google Sheets, SAP etc.

60362713.png
Potential Alternatives

You could replace the triggering Slack module with a Scheduling to just run the ML Script frequently.

You could also replace the Slack module at the end with a messaging module of your choice e.g. Email or Microsoft Teams.

Possible Use Cases
  • Run complex Python scripts in Action Flows and use the results for different use cases

  • Integrate ML capabilities in your Action Flows