Messengers

icon picker
Telegram

is a messenger that has a web version, a desktop version, and a version for mobile devices. Has built-in chatbot functionality.

Connection

1. Creating a bot on the Telegram side

First of all, you need to make a configuration on the Telegram side.
Open Telegram and log in.
Search for the “BotFather”
@Bot
. ​
image.png
.
Create a
@Bot
in Telegram:
Send the /newbot command to the BotFather
@Bot
.
In response to the
@Bot
message, enter the desired name for your
@Bot
.
image.png
Enter your desired
@Bot
ID. It must be unique among all existing
@Bot
s in Telegram and end with “bot”. For example, My_new_telegram_bot_username_bot.
image.png
If the submitted
@Bot
ID meets the requirements, you will receive a successful bot creation message. The message will contain a link to your
@Bot
in Telegram and an access token to the
@Bot
.
image.png
Copy the access token to a convenient location.
tempsnip.png
You can configure the avatar, description, and other parameters of the bot through the BotFather
@Bot
.
This completes the configuration of the
@Bot
in Telegram.

2. Agent channel configuration in the Platform

You need to create and configure an
@Project Channel
with the “Telegram” connector.
Click on the
@Agent
settings button. ​
image.png
Click the Add channel button. ​
image.png
The
@End Channel
selection panel will open. ​
image.png
Select
@Telegram
.
The
@Project Channel
creation panel will open. ​
image.png
Optionally, enter a title for this
@Project Channel
in the Name field with the placeholder New channel. ​
image.png
Paste the previously copied token into the Telegram bot token field. ​
image.png
Optionally, enable receiving of service messages by switching the toggle switch. ​
image.png
To save the
@Project Channel
without activating it, click the CREATE button. ​
image.png
To save and activate the
@Project Channel
, click the CREATE & ACTIVATE button. ​
image.png
The
@Project Channel
will be saved and activated if:
The
@Agent
is trained;
The token in the Telegram bot token field is unique (there are no active channels of the same type with the same token);
The channel address is accessible;
The channel webhook is registered succesfully.
The
@Project Channel
will be saved but not activated if one or more conditions are not met.
To cancel
@Project Channel
creation, click the CANCEL button. ​
image.png

Editing and Deleting Agent Channel

To edit an
@Project Channel
, click on its icon on the
@Agent
card. ​
image.png
To edit any field, click the field and enter a new value.
To apply changes to an activated
@Project Channel
, click the APPLY button. ​
image.png
Changes will be applied if:
The
@Agent
is trained;
The token in the Telegram bot token field is unique (there are no active channels of the same type with the same token);
The channel address is accessible;
The channel webhook is registered succesfully.
Changes will not be applied if one or more conditions are not met.
To deactivate the
@Project Channel
, click the DEACTIVATE button. ​
image.png
To apply changes to a non-activated
@Project Channel
, click the SAVE button. ​
image.png
To apply changes and activate the
@Project Channel
, click the SAVE & ACTIVATE button. ​
image.png
Changes will be applied and the
@Project Channel
will be activated if:
The
@Agent
is trained;
The token in the Telegram bot token field is unique (there are no active channels of the same type with the same token);
The channel address is accessible;
The channel webhook can be registered.
Changes will be applied but the
@Project Channel
will not be activated if one or more conditions are not met.
To cancel making changes, click the CANCEL button. ​
image.png
To delete the
@Project Channel
, click the DELETE button. ​
image.png

Communication

Communication in Telegram group chats

The
@Bot
can be added to a Telegram group chat and process messages and events from this chat.
In order for the
@Bot
to process all messages sent to the group, you must provide it with access to all messages by turning off the Group Privacy setting:
Go to BotFather;
Write the command /mybots;
Select the desired
@Bot
;
Go to Bot Settings → Group Privacy;
Select Turn off.
When the Group Privacy setting is enabled, in order to send a message that will be processed by the
@Agent
and recorded in
@client_message
, you must either reply to the
@Bot
’s message (reply) or write your own message after the / symbol.
After each processed message, the
@Channel Variables
will be set to the data of the group member who sent the message.
Also, the
@Agent
processes events about new users being added to the group chat. In this case, a string like “telegram_chat_new_member: telegram_user_id|telegram_username|telegram_first_name|telegram_last_name” will be written to the
@client_message
variable.
When upgrading a group to a supergroup, a new group ID is generated and the
@Agent
cannot send a message.
Service messages in Telegram
5
Message
End channel
Format in client_message
Description
Cases
1
Telegram group user joined the group
Telegram
String: telegram_chat_new_member: {user.id}|{user.first_name}|{user.last_name}
When a user joins a Telegram group, a message is sent to the
@client_message
context variable in accordance with the template
When a new user joins a group, the Bot can welcome him to the conversation by displaying his name. For example, you can add a
@Script Branch
where the
@Agent
will respond to this message and display the text “Hello, {user.first_name}|{user.last_name}! Welcome to the group!”
2
Telegram group user left the group
Telegram
String: telegram_member_left_chat: {user.id}|{user.first_name}|{user.last_name}
When a user leaves a Telegram group, a message is sent to the
@client_message
context variable in accordance with the template
When a user leaves a group, the Bot can display a message about this. For example, you can add a
@Script Branch
where the
@Agent
will respond to this message and display the text “Unfortunately, {user.first_name}|{user.last_name} has left the group”
No results from filter
About what service messages are and how to activate their transmission from the
@End Channel
:
Mapping of Channel variables from Telegram
18
Channel variable
End channel
Variable in the body of an incoming request from a channel
Peculiarities
1
channel_visitor_id
Telegram
id
When replying to a bot message in a group chat, the id of the responding user is written to the variable
2
channel_conversation_id
Telegram
id
3
channel_visitor_firstname
Telegram
first_name
4
channel_visitor_lastname
Telegram
last_name
5
channel_visitor_phone
Telegram
6
channel_visitor_email
Telegram
7
channel_visitor_account
Telegram
username
8
channel_visitor_auth
Telegram
9
channel_visitor_source
Telegram
10
channel_message_id
Telegram
11
channel_reply_to
Telegram
If the
@Bot User
's Message is not a reply to the
@Bot
's message in Telegram, the variable remains empty
No results from filter
Communication in Telegram
20
Functionality
Channel
Availability
Description
1
channel_chat_id
Telegram
Yes
Format: channel_visitor_id|telegram
2
Messages will reach the Bot User if the Agent writes first in an existing chat
Telegram
Yes
3
Transfer to operator
Telegram
No
There is no such functionality in the messenger
4
Buttons
Telegram
Yes
5
Transferring files as links from the Agent
Telegram
Yes
The file will be transferred by link if it does not meet Telegram's requirements for files of this type.
6
Transferring files as files from the Agent
Telegram
Yes
Telegram can accept and send “file” attachments to
@Bot User
s only in gif, pdf and zip formats. Support for other formats is possible, but Telegram does not guarantee it.
When trying to transfer an image in the
@Attachment
slot, if a link to a file from Telegram is specified, the file will arrive as a link, not an image
7
Receiving a file from the Bot User into a script
Telegram
Yes
A string is written to
@client_message
: file:File type|File ID|File link, for example, file:photo|HgYjJJGYuxkBAAMNYK1eZR1fbZv-KQ09Omcsz9A8AjwAAsSzMRtug3FJ079jiwXcvo-egdKiLgADAQADAgADeAADE7gCAAEfBA|https://api.telegram.org/ file/bot1815753186:AAH_LtRWy_FSDAGFgstlTaQdkHHIFHV3xGI/photos/file_0.jpg . In this case, the file will be available via the link within 24 hours. To receive the file in the future, you will need to update the link to the file using the .
8
Receiving geolocation from an Bot User in a Script
Telegram
Yes
The
@client_message
contains a string like location:Latitude|Longitude, for example, location:83.000000|54.000000
9
Delivery of messages over 1000 characters from Agent to Bot User
Telegram
Yes
Messages up to 4096 characters are allowed
10
Markdown usage
Telegram
Yes
Works according to
11
Mailing with Notification
Telegram
No
No results from filter
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.