Trigger Machine Learning Script
Integrating Machine Learning (ML) scripts into your Action Flows can significantly enhance your automation capabilities. This guide demonstrates how to trigger an ML script using a Slack message, providing a seamless bridge between your communication channels and advanced data processing.
Key features include:
Slack Integration: Monitor specific channels for trigger phrases (e.g.,
%%forecast) to initiate workflows.Customizable Variables: Easily configure your team domain, environment clusters, and application keys.
Flexible Execution: Send POST requests to the ML API with support for custom execution timeouts and retry logic.
This workflow creates an automated bridge between your communication channels and your data science environment. It consists of two primary stages that move from message detection to script execution.
Monitor Slack
%%forecastExecute Script: Once the trigger is identified, the flow authenticates with the Celonis API and starts the pre-configured Machine Learning script.
![]() |
Below you will find the step-by-step guide for configuring each module of the above Action Flow.
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.
![]() |
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
![]() |
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.
![]() |
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.
![]() |
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
![]() |
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!
![]() |
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}}"
}![]() |
The request content can include an execution timeout. The JSON looks like this:
{
"notebookId": "notebookId",
"executionFileName": "executionFileName",
"executionTimeout": 24,
"maxRetries": 0,
"timeUnit": "HOURS"
}timeUnit can be “HOURS” or “MINUTES”.







