How to Create an Automated Flow for a Telegram Chatbot

The flow builder is the main tool to set up your bot to welcome new subscribers, assist users, sell products, and notify a manager about users’ questions in the chatbot. Also, a chatbot can gather information and send it to your system for future use.
All you need is to create keywords, design the bot’s structure, and drag-and-drop elements in the SendPulse flow builder.

Below you can find a detailed table of contents. Use it as a map for comfortable navigation to find all of the possible triggers and elements to get started adding them to your bot’s flow.

Choosing a Trigger for Your Flow

By default, there are “Welcome message,” “Standard reply,” and “Unsubscribe from bot” flows. And you can create your own new triggers to get more functionality.

Choose your bot. Navigate to the “Bot Structure” tab and choose a trigger.

Welcome Message Flows

The flow starts after a user subscribes to your chatbot - i.e after clicking the “Start” button.

Users can subscribe by following a link to your bot, finding the bot on the Telegram app by its @username or using a website widget.

This flow introduces your bot to users. Here you can write about your bot and its features - how the bot can be useful, what information bot can provide, and how often bot will send messages and the content of those messages.

Standard Reply

The flow will launch in response to any user question that is outside your bot’s scenario, or by sending an image to a bot. Here you can add a message with information, that a manager will contact during them during business hours and reply to the user.

You can set up a cool down interval for launching a flow that is between 1 minute and 24 hours - so your bot won’t launch a second time within the specified interval.

Unsubscription from Bot

This a flow with one message element that will launch after a user unsubscribes using the /stop or /unsubscribe command.

Trigger Flow

You can add keywords - triggers, that your bot will react to and launch your flow.

Click “Create a new trigger.” Write your command using one or several words. For example, you can use the words “Order,” “Tickets,” “Price,” or “Delivery.”

If the user enters part of a keyword linked to your command, your bot will suggest prompts such as a button with the name of your trigger. When the user clicks the button, the flow will launch.

To disable this feature, go to your chatbot settings and select the "Disable bot suggestions when entered messages do not match a keyword" option.

Building Your Flow

It’s important to think about the architecture and logic structure of your bot carefully. A well-designed bot will let users easily get a reply to their questions or place an order successfully by providing the necessary information.

Formulate the bot’s tasks, divide its functions into sections, think of how you will connect the elements, and start creating your bot’s flow using our drag-and-drop builder.

All the elements available in the builder are optional, you can even stop building after the first message element.

We recommend checking out the different varieties of chatbots and strategies for building your bot on our blog.

The Start and “Message” Elements

Every flow starts with the “Message” element. You can add text, images, files, a delay, and user input elements within the “Message” element.

You can add the “Message” element to any part of your flow. For example, in the last block of your flow, you can thank your users, confirm their order, and send information from your gathered variables, asking if the information is correct.


Within the “Message” element select the text element type and add the text of your message. Also, you can add emoji and variables to personalize your messages.

To add a variable click {} in the right corner of the text block and choose the variable you want to add from the drop-down menu. If you have a value for this variable in the user’s contact information, they will receive a message with the value filled in.

You can add the following types of variables:

  • Custom variables for contacts. You can transfer variables when a user subscribes. Set and update variables manually in the "Audience" section. Set and update variables automatically in the flow with the following elements: "Action - set variable," "User input," and "API request."
  • System variables. You can insert the text of the last message from the subscriber using the last_message variable. You can also display the subscriber ID using contact_id.
  • Global variables. You can create your own variables in the bot settings and use messages with predefined values that will be general to all of your subscribers. By default, $bot_name and $bot_id are available.

You can also format text to better visualize and highlight information.


You need to add a button or user input element to the message element if you want to connect it with other elements in your flow. This is one of the most important elements for communicating with your users - buttons engage users and let them chose a direction for your bot to take them to the next part of your flow.

To add a button, click + Add Button. Select the type of button: "Continue flow," "Link" or "Payment."

Name your button in the first field. Note, you are limited to 20 characters. Also, you can add emoji to the button’s text.

The text on the button should be easily understandable - it’s important for users to understand what will happen when they click on the button and know what specifically they need to choose. Make sure that the next element in your flow corresponds to what the button says it will do to maintain the logic of your bot.

For a button with the "Link" type, you can also attach a link to a third-party resource.

Please note: To allow the user to continue the conversation by clicking on the link button, you need to activate the "Link Tracking" option in the chatbot settings under the "General" tab.

You can add up to 13 buttons and for the “Continue flow” type and choose the layout that suits you best — from 1 to 4 in a row.

For the user, the buttons will look like this (below you will see "1 in a row" and "2 in a row"):

We recommend adding “Back” and “Back to main” buttons after all the information you add, so users can change their choice and choose another path through your flow. This prevents the logic of your bot from being trapped or broken with one message.

Quick Replies (Keyboard Reply)

You can also add another type of buttons — “Quick Replies,” (preset replies for chatbot users) which do not save user data (as it saves in “User input” function), but you can use it to expand the number of buttons and link each button to the next branch of your scenario.

Likewise, you can use buttons as an additional menu and improve navigation for your chatbot.

To add quick reply buttons, click “Quick replies” in the editing panel of the “Message” element and enter a name for the button.

You can use emoji in your button text and add up to 10 buttons to the message element.

Quick reply buttons are displayed to the user immediately below the text input field. Users can hide the buttons and reveal them by clicking in the text input field on the corresponding icon located on the right.

For the user, the buttons will display like this:

You can combine “Quick reply” buttons and regular buttons, but users will receive an additional emoji message in this case.

After sending the next message, quick replies disappear. To quickly get a message with these buttons, we recommend creating a trigger and a flow on this trigger. Then, place the flow in the menu, which is always shown to the user and expands when the "/" icon is pressed


Diversify your messages by using visual content that relates to your text.

Click the Select file button to upload an image from your computer or device, or drag and drop a file into the upload field.

There are no limitations to the size of the image, but note, that the image resolution for Telegram will be 500 px in width and 200 px in height.

To upload an image from a link, select "Upload image by URL" in the drop-down menu and specify the link to the image in the field.

You can also specify a dynamic path to the image. For example, using the "API request" element or from the a360 event, launching the flow via API, you can send a product picture and use this variable in the following message, displaying order data to the client.

To do this, select a variable or specify a JSON path in the field and pass the path to the image in the variable's value. Thus, each client will receive an image according to their order.


You can add files in any format except executable files of up to 5MB. Attach tickets, maps, checklists, instructions, or other additional materials.

Media: "Audio" and "Video"

You can also add audio and video messages to your flow scenario. Maximum upload file size — 20 MB.

Thus, you can attach video lectures and voice consultations directly in the bot without sending the user to third-party resources.


Divide long texts into passages up to 4 lines with the “Delay” element. This element will imitate typing by showing the typing animation and gives your user a rest before the next message.

Click the “Add” button and choose the “Delay” element. Enter a value in seconds - from 1 to 5.

User Input

You can gather information from users and save it to a variable for future use. Users can enter any value and you only need to set up the type of validation for this value — string (for text values), number, date, phone number, email address, URL, regular expression, or geolocation.

Activate “Wait for the subscriber's response”. Choose the validation type, add a warning message for users who enter the wrong value, and choose the variable where you want to store information.

For example - you have text block “Specify how many tickets you want to reserve.” The validation type will be “Number,” if a user enters a non-number value, they will get your error message.

Another example: “Leave a link to your Facebook account”. You should choose the “URL” validation type here.

To send a geolocation, in the chatbot chat, the subscriber must click on the paperclip icon, select "Location," and click "Send My Current Location. " The chatbot will save the link to the specified variable.

Please note that geolocation only works in Telegram’s mobile app.

The received email address, phone number, and other user data are saved in the automatically generated mailing list from our Email service.

You can also choose the period to wait for a response from the user. If the user does not respond within the selected time, the wait for a response from the user will expire and the chatbot will no longer check the entered data for validity to record user's response.

Also, under the message, you can add quick replies buttons - so users can choose from predefined responses instead of typing their own.

To do this click on the “Quick replies” button in the “User input” element window and enter values for the buttons. You can add up to 10 buttons.

You can add quick replies for data with the "String," "Number," and "Regular expressions" validation types. For example, enter a specific word by the user, enter the quantity of a product, or select a product category.

For data with the "Phone" and "Email" validation types, the messenger prompts the users to use the contact details of their account.

You can divide your scenario and send the next message, depending on whether the user entered the requested data (green dot branch) or not (red dot branch).

Note the difference between standard buttons and quick reply buttons: quick reply buttons are the bot’s element that saves information of the chosen button into a variable.

And click on a standard button redirects the user to another element of your flow according to your scenario or to an external source.

Moving Elements

By default, each element you add is placed at the end of the message element you are working on. Hover on the element that you want to move up or down and click on the corresponding button.

Connecting Elements

Drag a line from the blue drop of one element to another element to connect them.

Click on the line twice and you will see a button to remove a connection.

The disconnected elements will be highlighted in yellow, remember that you need to link it to another element.

Elements with empty fields will be highlighted in red, reminding that you need to fill in fields. For example - if you added a button, but did not enter text for it or used a link element, but did not enter a URL. You cannot save your flow until you fill in these fields.

Adding “Action” Elements

Only you can see the “Action” element, it will not provide content to your users. Choose this element from the left panel and drop it near the block you want to link. Then choose which action you want to add.

Opening a Chat with a Human

Choose the “Open the chat” action for a personal consultation - this is for cases when chatbot’s work is done and the user wants personal communication. This action will open a live chat with the bot’s admin. 

You can turn off bot auto-replies when opening a chat flows. This will help in cases where the subscriber is already waiting for a manager and so that the bot won’t send a message at that moment.

Also, you can set up email notifications for the manager about an open chat that will be sent to the email addresses used to register the account or enable web notifications in the browser.

Unsubscribing from the Bot

Users can unsubscribe from your bot with the /stop and /unsubscribe commands, but also you can set up that automatically. Use the “Unsubscribe from the bot” action for the branch of your scenario where you need to delete users from your audience list to never send them messages again.

Adding Tags

Add tags to mark user’s preferences and use them to create more personalized campaigns in the future.

Removing Tags

Remove an existing tag from a user if it becomes irrelevant.

Adding Variables

Add a value for the variable to use information in the future - it can be information about an order or personal data, which will help filter your audience for targeted campaigns.

If you are using a website widget or advertising to launch trigger flow - you can create a “Source” variable and place this element after the “Start” element.

You can view saved variables on the “Audience” tab of your bot.

Sending Webhooks

Add this action after an event, about which you want to be notified. For example, if a specific client just made an order. Your CRM will get a POST request with that subscribers’ data, and any variables and tags that the bot gathered.

To add an element to the flow choose the “Send webhook” action. In the first field enter a name for the webhook so that you can easily find it by name in your system and filter it. In the second field add a link to your handler where the POST request will be sent.

Create deal

You can integrate a chatbot with your CRM. To do this, add the “Action - Сreate deal” element after a specific user action, for example, clicking the Submit order button.

Select a pipeline and deal stage — the pipeline and stage to place a deal card. Then, enter a deal name. You can also add a variable to the deal name to pass custom data.

Adding the “Flow” Element

You can simplify your bot’s structure and move your user to another flow.

To do this, add an element, then choose the “Flow” element and select the flow you want to link from the drop-down list.

The “Flow” element will be the last element in this branch of your existing flow. You cannot link it to another element to continue the original flow.

Adding a "Filter" element

Segment customers based on their personal information and history of receiving your previous messages. Select the Filter element in the left sidebar and drag it after the element that will start your branching scripts.

Then select the condition itself. You can filter by:

  • variable value (all types - string, number, email, phone, and link);
  • assigned tag;
  • participation in the flow;
  • campaigns received;
  • run time.

Combine conditions by adding the operators “any” or “all,”, or add independent additional conditions.

After adding conditions, add the additional flow elements to each of the Filter element options if the condition is met (green dot) or not met (red dot).

Adding the “Pause” Element

This is the period during which no automatic messages are sent to the subscriber. The pause can be set in minutes, hours, or days.

You can choose to pause in between using the "Time period" option or until a specific time using the "Till date" or "Till Time" option.

Select the "Time period" option and set a pause between sending flow elements from 1 minute to 24 hours. Use it in a flow, for example, to warm up a client. After the specified time, the next message will be sent.

If you select a pause of more than 1 day between elements, you can set the time at which the message will be sent. The system considers the next day any time after 00:00 according to the time zone set in the settings of your personal account.

Also, you can select "Till date" or "Till time" and set a delay until a particular time. For example, you can use this option to indicate business hours or promotion hours.

Also, using the "Pause" element, you can set the condition for executing the next element of the flow: always or when the subscriber is inactive.

Adding the "API Request" Element

Send requests to a third party server to create objects or retrieve data. Get data and use it in your chatbot messages.

You can save the received data to a variable or add it to a message as JSONPath.

Drag the "API Request" element to the workspace, connect it to the element, after which you want to retrieve data. Select the type of request and enter the URL to send the request to.

Selecting a flow

After testing the request and receiving a successful response, configure the mapping settings. If you need to save the value from the response to a variable, select the key from the received request and the variable to save to. If you want to use the received value once without saving it to a variable, copy {{$ ['somekey'] ['nestedkey']}} and use it in the next message element.

Selecting a flow

Adding "Random choice" Element

Send elements from your chatbot script at random for A/B testing, creating quizzes, and more. You can customize the size of the recipient group for each option, send random information, and test different chatbot scenarios.

Drag the item "Random choice" element to the working area, connect it to the element you start branching the script from.

Learn more: How to Use the "Randomizer" Element.

Save and Launch Your Flow

When you finished creating your flow and have looked over all of the elements, save your flow before exiting. Click “Save and send it to yourself” to test the flow and check if everything is working correctly.

After that, you can exit your flow by clicking “Save and exit”

Managing Your Flows

You can enable and disable flows at any time by choosing a flow and switching it on or off from your chatbot dashboard.

Disabled flows will have a grey switch.

Analyzing Your Results

Sendpulse allows you to track general statistics on a chatbot in the "Statistics" tab.

You can see the number of messages sent and read, redirections from the flow, both in total and separately for each message in the "Bot structure" tab.

It’s also possible to track statistics on button clicks in flow messages and statistics for users for whom the Action and Pause elements were triggered. Click the number on a button to see who clicked the button.

Rate this article about "How to Create an Automated Flow for a Telegram Chatbot"

User Rating: 5 / 5 (7)

    Other useful articles

    Popular in Our Blog

    Try a free chatbot for Facebook Messenger