Skip to main content

Celonis Product Documentation

Trigger an Action Flow from ML Workbench

In order to use the results and insights of your Machine Learning Script automatically, we provide you with a receiving Action Flow that integrates the ML results into secondary actions. This template shows you the steps of a ML script snippet that pushes data to a receiving Action Flow and how the Action Flow can deal with this information. 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 two working Action Flows which:

  1. Use a Machine Learning script to send response data back to Action Flow

  2. Receive and resends the answer from the ML script

60361704.png
Configure ML Script Snippet

Copy the following script snippet into a new or existing ML App.

import json
import re
import sys
import requests



## you can choose any data to send to webhook, as long as it is in json format, for example
json_transfer = {'email_to': email_to,
                'info1': value_ABC,
                'info2': value_BCD
                }
data = json.dumps(json_transfer)


webhook_url = '< paste your webhook url here >'

byte_length = str(sys.getsizeof(data))
headers = {'Content-Type': "application/json", 'Content-Length': data}
response = requests.post(webhook_url, data=data_df, headers=headers)

The ML script will run your pre-defined Python logic that you either trigger manually in the ML Workbench or by a different Action Flow (see here).

Response Script Snippet

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, 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. From your Celonis Platform team, click Data - Machine Learning.

Data_-_Machine_learning.png

2. Open an existing App or create a new one (click New App).

3. Import the script provided above

60361492.png

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

60361499.png
1. Customize ML Script Response

Required:

  • url: paste here the URL of the Webhook of the module from the Action Flow below (do not delete the quotation marks ' ')

Optional:

  • message: you can adjust the message of the response

  • title: you can adjust the title of the response

Additional data fields

Add new fields (e.g. results of your ML Script) by copying the structure of the fields before and adding it additionally to the JSON called "fields" in the same way title and value are defined

Configuring Action Flow

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

1. Receive ML Script Response

In this module we define a Webhook where we receive data from the ML Script.

60363058.png

Configuration:

Action Flows Module: Webhooks

Action: Custom webhook

Copy the address to clipboard and proceed in the next step where you add the URL to the ML Script

60363057.png
2. Re-determine Data Structure of the Webhook

1. Click on the blue button called 'Re- determine data structure'

60363057.png

2. As soon as you see it is trying to redetermine, send the triggering phrase in the Slack channel and run the triggering Flow. When the HTTP module shows the 200 code as a response it can take a few seconds

60363053.png

Note

Please run the script manually, the response will connect to the webhook and re-determine the data structure.

3. The webhook determined the data structure when showing you the green success statement. Click 'Ok' to save the structure and be able to continue.

60363052.png
3. Send Response in Slack

In this module we'll send the received data to Slack to controle if everything worked out.

60363056.png

Configuration:

Action Flows Module: Slack

Action: Create a Message

Enter a channel ID or name: Select from the list

Channel type: Private channel

Private channel: select the channel where you want to get the results of the ML script

Text:

title: {{fields[].title}}
value: {{fields[].value}}
60363055.png
Downloading Action Flow blueprints

To download blueprints for Action Flows, go to Marketplace. In the Marketplace page for your Action Flow, click the Download button to get the blueprint.

Blueprints can be imported into your Celonis Platform Team so that you can quickly make the required changes without needing to build the Action Flow from scratch.

Potential Alternatives

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

55707554.png
55706522.png
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