Want to see a step-by-step guide to using labels to repeat a question? Try our goto a label tutorial.
The flow service helps you to control flows, such as allowing you to trigger one flow from within another, or repeating actions within the same flow.
Trigger a Flow
The New Trigger (trigger) and Trigger a Flow (action) allow you to start one flow from within another using a word or phrase.
This is useful for structuring flows, so you can 'branch off' from one flow to one or more other flows, using filters to decide which flows to trigger.
Triggering another flow by keyword does not automatically stop the current flow. However, when you filter the action you can choose to stop the flow.
Trigger a Flow (action)
Using this action will run any matching Flow > New Trigger or Bot > New Message trigger(s). You can pass information across from one flow to another using Response Path (for passing across info about the bot user) and Metadata (for anything else).
For Bot > New Message triggers to be eligible, you must select a valid response path. Note that when triggering Flow > New Trigger, the word or phrase should be an exact match (although case doesn't matter).
New Trigger (trigger)
This will trigger when a Trigger a Flow action is run with a matching word/phrase. If more than one trigger is found with the word/phrase, then they will all trigger.
Metadata may have been passed across, and if so, will be available as a data output. If a bot response path was selected in the action, a set of bot related outputs will be available to your flow too.
Goto a Label
The Label and Goto a Label actions allow you to set a position in the flow (using Label), and then move the flow back/forward to that action (using Goto a Label).
After using Goto a Label, your next action will have available any metadata sent along with the action itself (as an output of Label), and the outputs of the trigger and any actions prior to it in the flow.
This action is simply a placeholder/marker to define a position within a flow, so that you're able to go back (or forward) to it using the Goto a Label action. Assign a word or phrase that will be used to reference it with Goto a Label.
Metadata may have been passed across, and if so, will be available as a data output. Note that it's not possible to add filters to this action, as they wouldn't be useful.
Goto a Label (action)
Using this action will cause the flow to go to the first matching Label action found. You can pass information into the Label action using the Metadata field, which will then be available as an output.
It's important to understand how going back and forward in flows affects the outputs you have to work with:
- If you go back, the action that runs after the label will have all the same output data available to it as when it was first ran, and every time thereafter, in addition to the latest metadata you send using Goto a Label. If you need to use any info you collected further along in the flow, you should send it as metadata.
- If you go forward, the action that runs after the label will have all the output data you collected up until Goto a Label, in addition to metadata sent along with it, but the outputs of any actions that were skipped will be empty.
As a precaution against infinite loops, the Goto a Label action may be used 20 times (in total) during the course of a flow.