Notify
Automation in LetsFlow is handled by your backend or microservices. When a state transition occurs, the service needs to be notified. This is achieved through messaging.
If you're using the workflow engine, notifications are sent via a messaging queue or webhooks. However, if you're integrating the core library directly into your backend, you can leverage the event system provided by your framework to handle these notifications efficiently.
Implicit notify
For any action available for a service, a notify instruction is automatically appended to that state. The service can be referenced in the by
property of a state transition or the actor
property of an action.
If there's exactly one action that the service can perform, the trigger
property is automatically set to that action. If multiple actions are available the trigger
property is set to null
.
Properties
service
service
string (required)
The service to message
after
after
time
Delay notifying the service.
The time should be in the form of 'amount unit' in English, eg '10 minutes', '12 hours`, or `1 week`.
if
if
boolean or data function
If condition
trigger
trigger
string, data function, or null
The action that the service has performed when giving a response.
If the service provides a response and multiple actions are available to the service, you should use a data function to determine which action has been executed. The data function is evaluated after receiving a response and not when the state is instantiated.
message
message
string, object, or data function
Custom message to send the service.
Standard message
If message
is omitted, the standard message is sent. This is;
process
process
actions
actions
array of instantiated actions
The actions that the service is allowed to perform in the current state.
instructions
instructions
string
Instructions for the service as defined in the scenario for this state.
Instructions are mostly useful when the service is an AI agent.
Last updated
Was this helpful?