Updated by Kayalla Barreto
Flow is the conditional logical tree visual representation applied for your contacts when they are in the flow. When the contact is in a flow, they interact directly with the steps. The steps are composed by Action commands, Rules commands and determine the flow length, that can be a simple and short flow or a complex and extensive flow.
The action command “ActionSet” represents some operations done in your flow. Essentially, these are commands that allow you:
- Send an SMS answer “SMS response” (standard to “send a message”: action – will send a message to the actives contacts to reach this flows step);
- SMS to somebody else;
- Add a label to a Message;
- Update the contact (with a value received from an answer, for example);
- Add a contact to a group;
- Remove contact from a group;
- Make a call to an external server;
- Send an Email;
- Set the contact’s main language;
- Start another flow;
- Start someone else in a flow;
- Action commands comprehend actions executed immediately, on a top-down order.
Rule Sets are connection points in a flow. They are conditionals declarations that allow you to direct your contacts using:
- A received or recorded message
- A contact field
- A flow variable
- A form field
- An expression
Rule Sets comprehend 5 entries that allow you to build a powerful conditional instruction:
- The type of rule set that you would like to build:
- “Wait for response”: Wait for the user answer, after that, evaluate according to the created rules.
- “Call WebHook”: Call a URL, passing for the flow context* and save a JSON answer for reference using the @extra variable.
- “Split by flow field”: executes the answer rules collected by a set of previews rules referred using the @flow.variable[Variable-name], for example, @Flow.cidade.
- “Split by contact field”: Executes the answer rules saved in a contact field (name, phone number, etc.), referred using @contact.variable[variable name], for example, @contact.State.
- “Split by expression”: Execute answer rules using the expression result, as @(REMOVE_FIRST_WORD (step.value)), it includes a function that removes the first word of the last received message, represented by @step.variable.value. Expressions can include only one variable, only one function or a combination of variables and functions.
- “Split by message form”: Execute answers rules about a value split by a delimiter, for example, 1 + 2 + 3 + 4 + 5 (+ is the delimiter, while 1 is the first value, 2 is the second value, 3 is the third value, etc.).
- Depending on the type of the command selected, this is the value that the rules are going to be evaluated. This value, requires an operator, represents a variable or an expression. On the rule set on the picture below, “If the message..” indicates that the operator is @step.value or a received message.
- “Response Rules”: evaluate the selected operator. Response Rules are executed from left to right. The first rule correspondent starts. RapidPro combines one word per time and just one individually rule on the original string order.
- The answer rules value(s) will try to correspond the operator. Looking the example above, we create a rule set that tries to correspond to the cities from Alagoas. Using the “Wait for response” rule set the answer selected “has any of these words”, the received answers will be placed on the category named “Alagoas” if this corresponds to some listed word. This allows us to place the answer “I live in Maceió” on the category “Alagoas” because the word “Maceió” is contained on the rule. Notice that flow will always be correspondent at least one rule.
- The category where the contacts are located if the answer corresponds to a correspondent answer rule. The categories are the way where the connections can be guided to new steps, orienting the contact.
- The name given to the created variable “flow” is filled for a rule set. On the example above, the rule command will save the evaluation result for the flow variable @flow.state.
When someone is at this point in the flow, wait for an answer. If the answer contains any of these words -. ‘Maragogi’, ‘Arapiraca’, ‘Maceio’, etc. – classify as Alagoas on the flow variable ‘State’.
*Flow context comprehends the available variables on a determined flow. These are the flow variables used by action commands, but you can add contacts variables associated with a contact used through a flow, or data obtained from an external font through a webhook.
Flows are exclusive spaces where your contacts will get in and get out. When the contact is on the flow, it becomes a flow active member until the contact goes out of the flow. Passages through flow from entry to exit - it is all activity that happens in the middle- constitutes a “race”. Races and activities happened into the flow are exposed as a flow result. “Races” flow can be listed and started externally through an API. The active members' number is represented by the blue button located on the top left of each rule set.
You can click on the icon to see the active contacts names on this step and, if necessary, send them an accompaniment message.
Getting in a Flow
You can put them in a flow using the button “Start the Flow” on the flows editor;
- They can put contacts on a flow started by a campaign event;
- They can start a flow through a trigger.
- A contact started a flow calling to a telephone number on its channel.
- A flow is started by a lost call;
- A contact started by a flow through a message send for your channel that is not processed in another place.
Getting out a flow
A contact will get out of a flow when:
- Completes a flow finishing the last step;
- Passes for a step that don't have a continuation;
- Passe for an action that starts another flow;
- If the flow participation expired after a determined time of definitely inactivity on the flow dialog actualization into the flow editor.
Members Rules Flow
The contacts will interact with a flow one-by-one. If contact is simultaneously located in more than one flow, the answers will be processed in the most recent flow. While a contact is active in a flow, the answers are processed exclusively for the active flow on the moment until the user goes out or the time limit.
The Best Edition Practices
- Keep the proportion of 1:1 Answer/Message The campaign's events exception are escalated for each individual contact, flows should correspond to each received message for a send message, and the opposite.
- Build horizontally We recommend building a vertical flow. The flow editor is projected to support the horizontal movement until a point but will expand indefinitely vertically.
- Segment your Flows If the flow is very large, consider dividing it in other flows using the rule command “Start another flow”.