Jump to specific label step in the current flow.
A label step has a special syntax as follows:
- (label name)
You can then reference these label steps in your jump components:
- jump: some_label
Here is a complete example:
steps:
- say: Hi
- jump: second_label
- (first_label)
- say: You reached `first_label`
- end
- (second_label)
- say: You reached `second_label`
- end
In this example the flow will jump from the second step to the step
containing the second_label
label step, and continue executing the flow
from there.
Actions
The jump
component is commonly used in action fields that are present
in triggers and flow control components.
For example, here is a flow with a trigger than jumps to a specific label
step when matched:
triggers:
- keyword: hi
- keyword: test
action:
jump: debug
steps:
- say: Hi
- end
- (debug)
- say: Debug message.
In this case, when the user types test
, the jump
component will execute
and jump to the debug
label.
Here is an example of using a jump component in the if
component:
steps:
- ask: What is your age?
- user_set:
age: (@ flow.result | int )
- if: (@ user.age > 18 )
then:
jump: confirm_age
else: next
...
Element details
type: meya.flow.component.jump
class: JumpComponent
path: /meya/flow/component/jump.py
signature: jump
Fields
field | description | required | signature | default | type |
---|---|---|---|---|---|
spec | Override the original spec for this element. | ○ | ○ | null | Spec |
context | Send context data with this component's event. | ○ | ○ | {} | dict |
sensitive | Mark this component's event as sensitive. This will encrypt the event if the Sensitive Data integration has been enabled. | ○ | ○ | false | bool |
triggers | Activate these dynamic triggers when the component runs. Check the component triggers guide for more info. | ○ | ○ | [] | list |
jump | The label to jump to. | ◉ | ◉ | StepLabelRef | |
data | Flow scope data to set before jumping to the label. | ○ | ○ | null | dict |
Usage reference
Basic
triggers:
- keyword: meya.flow.component.jump
steps:
- jump: STEP
Full
triggers:
- keyword: meya.flow.component.jump
steps:
- spec:
type: STRING
data:
STRING: ANY
timeout: 123
trigger_when: ANY
context:
STRING: ANY
sensitive: false
triggers:
- type: STRING
data:
STRING: ANY
timeout: 123
trigger_when: ANY
jump: STEP
data:
foo: bar