Intermediate Events
In Liberate, intermediate events are a powerful feature that allows workflows to wait for asynchronous operations or external events to occur before proceeding to the next step. These events act as synchronization points in the workflow, enabling interactions with external systems, human interactions, or long-running processes.
Why Use Intermediate Events:
Intermediate events serve several purposes and offer benefits in workflow automation:
- Asynchronous Operations: Workflows often need to interact with systems or processes that require time to complete, such as waiting for a human approval or a long-running external process. Intermediate events allow workflows to pause until the awaited operation is completed.
- External System Interactions: Workflows may need to integrate with external systems, APIs, or services to exchange data or trigger actions. Intermediate events enable workflows to wait for responses from these systems, ensuring synchronization and smooth execution.
- Human in the Loop: When a human interaction or decision is required during the workflow, such as approval or review, intermediate events provide the means to pause the workflow and wait for the human to take action. This facilitates collaboration between humans and automation.
Using Intermediate Events:
To use intermediate events in Liberate workflows, you need to follow these steps:
- Start the Workflow: Begin by starting the workflow instance using the appropriate method, such as an API call or an event trigger. The workflow instance will be assigned a unique instance ID, representing the specific running session of that workflow.
- Invoke Intermediate Event Service/Process: When you reach a point in the workflow where an intermediate event is required, you can make an HTTP POST request to the designated endpoint using a REST Task. This rest task typically will immediate precede the Intermediate Event
- The payload should include the instanceId, representing the workflow instance ID, the event message describing the event or operation, and optionally the context data relevant to the event.
- Processing the Event: Once the intermediate event is triggered, the workflow instance pauses at that point until the awaited event is received or the external process is completed. The workflow remains in this state until it receives a response or signal indicating the event has occurred.
- Continuation and Action Transformation: After the event is received, the workflow proceeds to the next step. Optionally, you can specify an action name and an action transformation to shape the data received from the event. This allows you to modify or map the data into the desired format and update the context for further workflow execution.
Workflow Execution: The workflow continues executing the subsequent steps based on the updated context or data received from the intermediate event.
Example Curl Request:
Here's an example curl request that demonstrates calling an intermediate event:
curl -X POST \
-H "Authorization: Bearer c47e84b4a354c720abe70199awe325e4a" \
-H "Content-Type: application/json" \
-d '{"instanceId": "<your instance id>", "event": "<your event message here>", "context": {}}' \
https://integration-core-sales-api.liberateinc.io/xmanager/event
Make sure to replace <your instance id> with the actual workflow instance ID and provide the appropriate event message in <your event message here>. Optionally, you can include additional context data in the "context" field of the request payload.
Intermediate events in Liberate workflows provide a powerful mechanism for handling asynchronous operations, external system interactions
Updated 9 months ago
