Skip to main content

Celonis Product Documentation

Trigger Machine Learning Script

Leveraging the results of the Machine Learning tool in Action Flows can be pretty helpful. That's why we provide that automation solution that shows you how to trigger an ML script from a Slack message in a channel of your choice, including a Script snippet for the connection to the Action Flow.

Sample Action Flow

The image below shows two working Action Flows:

  1. Watch a Slack Channel for a trigger phrase.

  2. Trigger a Machine Learning script

Use Case Enhancements

If you want to pass parameters to the ML script, please check out this template: Forward Parameters to Machine Learning Script

If you want to return data to an Action Flow, please check out this template: Trigger an Action Flow from ML Workbench.

60361483.png
Configuring Action Flow

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

1. Wait for Trigger phrase

To be able to trigger the ML script and Action Flows via Slack we use this module to keep track of all the messages in one specific private channel.

60361484.png

Configuration:

Action Flows Module: Slack

Action: Watch Private Channel Messages

Connection: Connect to your Slack account

Channel: Choose the channel from where you want to trigger the ML Script

60361486.png
2. Filter for Trigger phrase

We filter on the defined Trigger phrase to not trigger the ML script when sending random messages in the Channel.

Condition: {{Text}} from previous Slack module

Filter: Equal to (case insensitive) - Text operators

String variable: Enter text that is only used to trigger this AF (here: %%forecast)

String variable

In this context, %% or similar structures help to differentiate from other slack messages.

60361489.png
3. 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 correct 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: For example, GjV6ODBvghgv6r76r0YzkyLTkxZwjbflqjwhebfljwhebfqjhebfwlV5TEVCcjMzAHBFK0F8TXdGBTlqBWFlsVPNk (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
4. Trigger ML Script

This module sends a Post Request to our ML API and triggers a defined 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}}"
}
60361488.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 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