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

# Flow block types

Contents of this page:

* [Text message](#text-message)
* [Question](#question)
* [Choice of option](#choice-of-option)
* [Commit lead](#commit-lead)
* [Smart delay](#smart-delay)
* [Action](#action)
* [Randomizer](#randomizer)
* [WABA template](#waba-template)
* [Condition](#condition)
* Formula
* HTTP request

## 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_**\***&#x20;
* **\~\~**~~strikethrough text~~**\~\~**
* Combining the wrapping you can get \*\*_\~\~_\*~~_**bold italic strikethrough text**_~~\*\~\~\*\*

{% hint style="info" %}
#### **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.
{% endhint %}

### Adding Attachments&#x20;

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:&#x20;

* **Image.** The text of the message containing the picture will be displayed under the picture as a caption to the image.&#x20;
* **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.&#x20;
* **File.** File will also be sent as a separate message.&#x20;
* **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:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/z120wIvVaB1F0RmhHfAo/message_menu_show.png" alt=""><figcaption><p>Menu items</p></figcaption></figure>

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:&#x20;

* Phone number;
* E-mail address;&#x20;
* URL;
* Regular expression;&#x20;
* Value in the specified range.&#x20;

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):

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/MbfWLkQC2OokFxGXTDkY/email_checking.jpeg" alt=""><figcaption><p>Verifying the email format</p></figcaption></figure>

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 <mark style="color:red;">**(1)**</mark>:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/JOzn5mQDcCOjmRGZXggY/adding_choice_block.jpeg" alt=""><figcaption><p>Step 'Choice of option' adding and settings</p></figcaption></figure>

This step type has the following settings:

#### Message text <mark style="color:red;">(2)</mark>

You can use variables and formatting here.

#### Image <mark style="color:red;">(3)</mark>

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

#### Answer choices <mark style="color:red;">(4)</mark>

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.

{% hint style="info" %}
Only numeric or text values are allowed in the answer menu.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/mRxRRMFxIRdrNjJuxjuy/choice_block_menu.jpeg" alt=""><figcaption><p>Menu settings</p></figcaption></figure>

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 <mark style="color:red;">(5)</mark>.

In addition, we can allow users to enter values other than those suggested in the list—a special checkbox <mark style="color:red;">(6)</mark> 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 <mark style="color:red;">(7)</mark>.

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.

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/SvUKHplyrYVk4yIBrbDX/Screenshot%202023-04-05%20at%2019.02.07.png" alt=""><figcaption><p>Final block settings</p></figcaption></figure>

## 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 <mark style="color:red;">**(1)**</mark>. The result is recorded into a table accessible through the Leads menu item of your 1msg.io account <mark style="color:red;">**(2)**</mark>. The data from the table can be exported to an MS Excel file to be processed by your company staff:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/aUbEx2ei5UQTqJjZLhqa/adding_commit_lead_block.jpeg" alt=""><figcaption><p>Adding 'Commit lead' step block</p></figcaption></figure>

In our example in [this article](building-the-example-flow), we discussed the case when a potential client is offered special banking terms. To do this, we asked for the user's consent <mark style="color:red;">**(1)**</mark>, and if he gave it <mark style="color:red;">**(2)**</mark> — we triggered the Commit lead block <mark style="color:red;">**(3)**</mark>:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/jhdSKsW2Sw1t2RpT1PKn/commit_lead_settings.jpeg" alt=""><figcaption><p>Commit lead settings</p></figcaption></figure>

Let's see the block settings. 'Message text' is the message the user will see <mark style="color:red;">**(4)**</mark>. You can add an image to the message <mark style="color:red;">**(5)**</mark>, similar to other block types we discussed before. You can also add a menu here <mark style="color:red;">**(6)**</mark>. 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:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/qfc8eQOnDiJbVRvqkH2N/commit_lead_settings_2.png" alt=""><figcaption><p>Commit lead — staff-side settings</p></figcaption></figure>

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:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/OJU1R8rxP5mec8gKk249/leads_table.png" alt=""><figcaption><p>Leads table</p></figcaption></figure>

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:&#x20;

* Assign a tag to a contact;&#x20;
* Delete a previously assigned tag from the contact's tag list;&#x20;
* Start an another flow;
* Stop the flow.

The step block can be added from the Flow Builder's blocks menu <mark style="color:red;">**(1)**</mark>. Operations are added by pressing the Add button <mark style="color:red;">**(2)**</mark>:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/akLPdpdLJFW3nfGONBAT/adding_action_block.jpeg" alt=""><figcaption><p>Adding Action step block</p></figcaption></figure>

#### Operation: assign a tag to the contact

This operation assigns a tag to the contact. After choosing 'Add tag' from the drop-down list <mark style="color:red;">**(3)**</mark> you'll able to choose a tag from the appeared drop-down tag list <mark style="color:red;">**(4)**</mark>.

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/dULa5EEiChhmQrBEKGF1/action_adding_tag.jpeg" alt=""><figcaption><p>Assigning a tag operation</p></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/EcrKFM5mn3YjnEcqY5k8/action_tags.jpeg" alt=""><figcaption><p>Flow settings: tags adding</p></figcaption></figure>

The tags assigned to the user <mark style="color:red;">**(1)**</mark> will be visible in the contact card (Contacts menu item) <mark style="color:red;">**(2)**</mark>:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/Qwn2YTIfSZpBmQ2b8I7h/action_contact_card.jpeg" alt=""><figcaption><p>Assigned tags in contact card</p></figcaption></figure>

#### 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:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/XviwJQgZ2NNMUP906snU/action_flow_sequence_scheme.png" alt=""><figcaption><p>Flow sequence scheme</p></figcaption></figure>

#### Operation: Stop flow

Stops the current flow when switching to another one.&#x20;

{% hint style="info" %}
**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.
{% endhint %}



## 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 <mark style="color:red;">**(1)**</mark>:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/Gbh6TZvpUuTgvZnadEcm/randomizer_adding.jpeg" alt=""><figcaption><p>Adding Randomizer block</p></figcaption></figure>

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, ... <mark style="color:red;">**(2)**</mark>, 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 <mark style="color:red;">**(3)**</mark>.

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:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/L5c61nwm3ZYekAkWeQfQ/Screenshot%202023-04-12%20at%2001.14.43.png" alt=""><figcaption><p>Randomizing the greetings example</p></figcaption></figure>

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:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/wXtw33VukvPwz3Fydfsn/adding_waba_template.jpeg" alt=""><figcaption><p>Adding WABA template</p></figcaption></figure>

The WhatsApp Business template block will appear <mark style="color:red;">**(1)**</mark>. Clicking on it will open the template setup panel with the drop-down list of templates <mark style="color:red;">**(2)**</mark>.

### 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 <mark style="color:red;">**(1)**</mark>. After selecting, the settings of the specific template will appear. As you can see, we can load an image <mark style="color:red;">**(2)**</mark> 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):

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/ogNlQDkgY3hHtFn66Bw2/waba_template_settings.jpeg" alt=""><figcaption><p>Template settings</p></figcaption></figure>

### 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:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/ArHSFm5rVSyn2f1Pamrd/goto_templates.jpeg" alt=""><figcaption><p>Templates list</p></figcaption></figure>

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](https://help.1msg.io/welcome/flow-builder/building-the-example-flow#creating-the-age-request-step) to make it easier for the user to select an age with buttons. The preview of the template looks like this:

![](https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/4bVAjCX43qcJhnKMArC5/Screenshot%202023-04-24%20at%2004.22.41.png)

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 <mark style="color:red;">**(1)**</mark>:

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/6KjPgJXcT6IZfiojNoxv/condition_block.jpeg" alt=""><figcaption><p>Condition step block</p></figcaption></figure>

For illustration, the appearance of the block after the following settings is shown:&#x20;

* The "All conditions are met" mode is selected <mark style="color:red;">**(2)**</mark>;&#x20;
* the user's tag list contains the "Ready to Buy" tag <mark style="color:red;">**(3)**</mark>;&#x20;
* client is 18 or older <mark style="color:red;">**(4)**</mark>.

If all these conditions are met, the block connected to the node <mark style="color:red;">**(5)**</mark> will be executed, if the conditions are not met, the block following the node <mark style="color:red;">**(6)**</mark> will be executed. If you want to add another group of conditions, click Add <mark style="color:red;">**(7)**</mark>—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:&#x20;

* The user's tag list does or does not contain the specified tag;&#x20;
* Checking the current date:&#x20;
  * _date earlier or later than specified;_&#x20;
  * _earlier or equal to the specified date or later or equal to the specified date;_&#x20;
  * _equal or not equal to the specified date;_&#x20;
  * _contains or does not contain a value._&#x20;
* Same as with date, but including time.&#x20;
* Conditions with system variables, such as:&#x20;
  * _check what digits the user's number begins with to find out the user's country;_&#x20;
  * _check if the user is subscribed to a bot,_&#x20;
  * _check if the user has an avatar, etc._&#x20;
* 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).&#x20;
* 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 <mark style="color:red;">**(4)**</mark>.

## Formula

This step block type allows you to perform computational operations with variables. Add it by selecting the menu item <mark style="color:red;">**(1)**</mark>. After adding the block you'll be able to chose (from the dropdown list) the variable in which the value will be written <mark style="color:red;">**(2)**</mark> and write the formula <mark style="color:red;">**(3)**</mark>.

<figure><img src="https://content.gitbook.com/content/hUATFb1X4MrZmATrI8Pi/blobs/CdQHij1g7MWoLqnLsfEZ/adding_formula.jpeg" alt=""><figcaption><p>Formula block</p></figcaption></figure>

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

A number of arithmetic operations are available. Use the syntax as follows:&#x20;

* Addition: `a + b`&#x20;
* 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
