Flow block types

Here we will describe the "building bricks" that make up a flow

Contents of this page:

Text message

This step block displays a text message to the contact. You can use variables in the message and add pictures, videos and files. This block is most often used as the default step.

The message block supports emoji and partially Markdown Cheatsheet markup. Markup is supported in all blocks where text can be inserted. You can make a piece of text bold, italicized, or strikethrough by wrapping it as follows:

  • **bold font**

  • *italic text*

  • ~~strikethrough text~~

  • Combining the wrapping you can get **~~*bold italic strikethrough text*~~**

Variables

The variable is inserted into the message with double curly braces: {{variable_name}}. For example, {{Name}} can be used to refer to the user by name, if that name was previously stored in the dialog. A variable that is not defined or has no value will be output as an empty character.

Variables are stored in the user card and can have different formats: text, number, image, true/false and JSON. The Name and Number variables are loaded from the WhatsApp profile.

Before using them in flows, variables must be created in the Settings item, accessible from the Flow list.

Adding Attachments

You can attach a file, image or video to your message. To add an attachment, use the Choose file button next to the corresponding item:

  • Image. The text of the message containing the picture will be displayed under the picture as a caption to the image.

  • Video. Allows you to send a video clip. It will be received by the recipient in a separate message. Video files in H.264 video format and AAC audio format are supported.

  • File. File will also be sent as a separate message.

  • Picture from variable if variable contains picture URL.

Adding menu buttons

The menu items look like choices when the user needs to send 1, 2, 3... etc. in a reply message to select the appropriate menu item.

The menu is added to the Menu items. Below you can see how the menu is set up and what it looks like on the screen of the user's device. In the screenshot, the user selects Menu item 1 (sending '1') and gets a response from the "Item 1 was chosen" block, with which the 'Answer 1' button is connected:

To add an additional menu button click 'Add' and enter the button text.

Question

The question step block is similar to the 'Message', but allows you to write the user's answer in a variable. For example, we can ask his name and then address him in a more personalized way. To do this, let's add the {{Name}} variable in any blocks where we can enter message text—for instance, in the "Message" block or the next 'Question' block.

The user's answer can be checked against one of the formats:

  • Phone number;

  • E-mail address;

  • URL;

  • Regular expression;

  • Value in the specified range.

Have a look at the screenshot below. To check if the answer is entered correctly, we select the format from the drop-down list (1). Let's say, we want to verify the valid email format (2):

In the field below we've set the message that is displayed if the criteria are not met (3), and else below—the number of attempts if the data were entered incorrectly (4). If the correct answer is still not obtained within the given number of attempts, the flow skips on to the next step block. The variable will remain empty.

In the 'Question' block you can also attach a picture (but not a file or video) and add menu items—similar to the 'Message'.

Choice of option

This step block allows you to give your client a choice of several options and write the result to a variable. The block is added by selecting the corresponding steps menu (1):

This step type has the following settings:

Message text (2)

You can use variables and formatting here.

Image (3)

The text will be displayed as a caption to the picture, similar to the 'Text message' and 'Question' step types.

Answer choices (4)

Unlike the menu items in the 'Question' block, the 'Choice of option' block only saves the user's answer without leading to a branching of the flow.

Only numeric or text values are allowed in the answer menu.

The value written to the variable can be set to a different value than the one offered in the menu. For example, the user selects Deutschland, but the variable will store 'Germany'—this is useful for example, when we want to display a menu item in the client's native language. To enable it, check the 'Specify a different value to be saved on this answer choice' box (5).

In addition, we can allow users to enter values other than those suggested in the list—a special checkbox (6) is responsible for this. Otherwise, if the user's answer is not on the list, the user will get an error message. The text of the error message is specified in the field below. You can also set the number of correct entry attempts. The order of the menu items can be changed using the arrow buttons (7).

We can give the client the option of not answering this question and create an additional answer option, such as "Skip the Question". This will be shown as another menu item.

Commit lead

Saves a request from the user, e.g. when a customer wants to contact customer service or has agreed to a sales call. The block can be added in the usual way from menu (1). The result is recorded into a table accessible through the Leads menu item of your 1msg.io account (2). The data from the table can be exported to an MS Excel file to be processed by your company staff:

In our example in this article, we discussed the case when a potential client is offered special banking terms. To do this, we asked for the user's consent (1), and if he gave it (2) — we triggered the Commit lead block (3):

Let's see the block settings. 'Message text' is the message the user will see (4). You can add an image to the message (5), similar to other block types we discussed before. You can also add a menu here (6). If no menu is added, the flow will immediately skip to the next block after making a lead record.

The Service Settings section refers to the your business. 'Notification message text/body' contains a comment for company employees. In the above example we created the comment "New retired!" You can include variables here (👱‍♂️ {{name}} and 📞 {{phone}}), as shown in the screenshot:

It's also possible to categorize the type of lead by using tags to then pass on to the appropriate staff. The tag is selected from the drop-down list at the bottom of the setup panel.

The result of the described block is the following entry in the Leads table:

If we didn't asked for user's name before, the {{Name}} variable gets it from a user's WhatsApp profile, also like {{Phone}} gets his(her) phone number.

Smart delay

[Updating...]

Action

This block type allows you to perform one or more operations:

  • Assign a tag to a contact;

  • Delete a previously assigned tag from the contact's tag list;

  • Start an another flow;

  • Stop the flow.

The step block can be added from the Flow Builder's blocks menu (1). Operations are added by pressing the Add button (2):

Operation: assign a tag to the contact

This operation assigns a tag to the contact. After choosing 'Add tag' from the drop-down list (3) you'll able to choose a tag from the appeared drop-down tag list (4).

The tags accessible in the list here must be defined beforehand, in the appropriate settings section (Flow Builder → Settings → Tags):

The tags assigned to the user (1) will be visible in the contact card (Contacts menu item) (2):

Operation: Remove tag

This operation removes the tag assigned to the contact before.

Operation: Start flow

This operation executes one of the other flows (which you have in your Flows list). Once executed flow is complete, the user returns to the one from which the transition was made from the Action block (the next block after the Action will be executed)—if the parent flow has not been stopped:

Operation: Stop flow

Stops the current flow when switching to another one.

Please note that if you've executed the another flow, but the 'Smart delay' step block was launched in the parent, the block following the 'Smart Delay' will be executed after the specified time interval has elapsed. To prevent this from happening, use the 'Stop flow' operation for the current flow when switching to another flow.

Randomizer

Randomizer is useful when you want to create a branching script at random. This comes in handy, for example, for creating a variety of greetings or distributing the audience for further A/B testing. A block can be added from the vertical menu as usual (1):

The operation of the block is similar to the menu from the Question or Text Message block, but with the difference that the choice is made by the server application in accordance with a given chance rate. The block contains several branching points — A, B, ... (2), with the value of the chance in percent, with which the block associated with the item will be executed. The block must have from 2 to 10 distribution groups. Each one has a percentage chance. The percentage value shows with what probability the user will get to that branch of the scenario. The screenshot above shows a 50/50 ratio—that is, the chances is equally distributed. To add a new branch (group), use the Add button in the 'Groups of distribution' section (3).

Let’s say we want to diversify the greeting sent to clients and decided that we will have three variants. In order do this, we need to create a randomizer block with three options in front of the greeting blocks. The flow fragment will look as follows:

This configuration gives a probability of 30, 30 and 40%, respectively. The last option will be chosen slightly more often than the first two. Logically, the total percentage should equal 100, as in our example.

The 'Choose randomly every time' checkbox is responsible for whether a random branch is selected every time or only at the first conversation. If it is not set, the particular user will be directed by the branch that was randomly selected at the first time. In our case, the greeting will be randomly selected every time.

WABA template

The step block allows you to add WhatsApp Business (WABA) template messages.

WABA templates are pre-created messages that can be used repeatedly. These templates can include order information, confirmations, delivery notifications, and other types of messages that are often sent to customers. Using templates has some advantages due to the fact that they are pre-screened and approved by WhatsApp. This way you can more clearly adhere to WhatsApp's policies. Using variables in templates allows for personalized communication, including information unique to each customer-such as customer name and order number. Using templates allows you to use buttons instead of menu items—the user can select the desired option with a simple tap.

To create a step, select it from the blocks menu as usual:

The WhatsApp Business template block will appear (1). Clicking on it will open the template setup panel with the drop-down list of templates (2).

Setting up a template

Templates can be selected from templates created and approved by Meta. For example, let's choose the movie ticket confirmation template (1). After selecting, the settings of the specific template will appear. As you can see, we can load an image (2) and specify a number of parameters. Parameter BODY #1 is responsible for the name of the movie. We've put a variable in there where we have the name of the movie written—{{movie_name}}. Parameter 2 in the field below is responsible for the time, and so on, as specified in the explanation for this template (Values of variable names):

Templates list view

WABA templates can be viewed and created in your WhatsApp Manager account or within your 1msg.io account. To get to the templates list, go to the Channels menu item, then select the desired channel and scroll down to the Templates tab:

You will see a list of templates. Some of the templates you create may be rejected if they do not comply with WhatsApp rules—they are marked as 'rejected'. Of course, you can re-create them by correcting the deficiencies.

Template preview

When you click on the template name, you'll see a preview of the message. For example, we created an age query template for potential customers of our imaginary bank from this article to make it easier for the user to select an age with buttons. The preview of the template looks like this:

We will discuss the creation of templates and the details of their configuration in a separate article.

Condition

This block type allows to branch scenario depending on whether one or more conditions are met. You can choose if all of the conditions are met, or at least one of them.

The block can be added as usual from the builder menu (1):

For illustration, the appearance of the block after the following settings is shown:

  • The "All conditions are met" mode is selected (2);

  • the user's tag list contains the "Ready to Buy" tag (3);

  • client is 18 or older (4).

If all these conditions are met, the block connected to the node (5) will be executed, if the conditions are not met, the block following the node (6) will be executed. If you want to add another group of conditions, click Add (7)—another branch will appear in the block next to (5). There can be several such groups, which gives you incredible flexibility in checking conditions.

The following criteria can act as conditions:

  • The user's tag list does or does not contain the specified tag;

  • Checking the current date:

    • date earlier or later than specified;

    • earlier or equal to the specified date or later or equal to the specified date;

    • equal or not equal to the specified date;

    • contains or does not contain a value.

  • Same as with date, but including time.

  • Conditions with system variables, such as:

    • check what digits the user's number begins with to find out the user's country;

    • check if the user is subscribed to a bot,

    • check if the user has an avatar, etc.

  • Conditions with user variables—any parameters can be used here (more or less, equal or not equal, contains a value or not, whether the value contains any fragment or not).

  • You can specify a complex formula in Python containing operations on system and user variables as a condition. The result of the calculation should be a value of type boolean. For example, an age condition can be written with the formula age >= 18, as we did in the example above (4).

Formula

This step block type allows you to perform computational operations with variables. Add it by selecting the menu item (1). After adding the block you'll be able to chose (from the dropdown list) the variable in which the value will be written (2) and write the formula (3).

In the example above we’ve implemented multiplying the selected variable (‘amount’) by the value of ‘rate’: amount = amount * rate.

A number of arithmetic operations are available. Use the syntax as follows:

  • Addition: a + b

  • Subtraction: a / b

  • Multiplication: a * b

  • Expanding: a ** b

  • Modulo division: a % b

Operations can be performed on the variable selected to write the result, as well as on other variables. Note that variables must be of the same type value (number). Do not use curly brackets in a formula in variable names.

HTTTP request