Connecting Telegram (private) to Albato: Integration options

Connecting Telegram (private) to Albato: Integration options
Telegram
·
5/25/2022
·
6 min. read

Now you can use not only the Albato Telegram bot, but also create your own. You can start an automation when the bot receives a message, and when a message has been sent in the group with the bot as well.

Connecting your Telegram bot to Albato, we enter our webhook in its settings to send all the events to Albato. It means that, if your bot is connected to another system and uses third-party functionality, then it will be disconnected and will use only the Albato functionality.

How to create a bot and get the API key

Create a bot and connect it to Albato or choose the one you have created before from @BotFather.

If you have a bot, follow these steps:

  • Send a /start command in a message to the Bot.
  • Send a /mybots command in a message if you have a bot and you need to receive its API key.
  • Select the bot from the list and request the API key you need to connect.

Telegram 1.png

If you need to create a bot, follow these steps:

  • send a /newbot command in a message
  • send a name of your bot. It will be public.
  • specify the user name. It will be displayed after @ symbol and should end with “bot”. For example: youNamebot or youName_bot.

When you get an API key for a new bot, you can connect it to Albato.

Telegram 2.png

How to create a connection

Open the Apps section, click the Add a connection button, select Telegram (private).

Telegram 3.png

Set the name for your connection.

Enter the API key copied from @BotFather.

Click the Continue button.

Telegram 4.png

The connection is ready!

How to use Bot

After connecting the Bot, any user sending the /start message will be automatically included in the list of chat IDs. If this command is sent to a group chat with your bot, it will parse the ID of the current group/channel.

In order to send a message to Telegram, you need to know the chat ID where the message will be sent. You cannot use a login or a phone number according to the rules of the Telegram API.

Due to this, if you want to send a message to a user or a group, the Bot in the required chat should receive a message with the /start command. After getting the chat ID, you can select it from the list and use it in the Send message action.

How the “Incoming Message” trigger works

The "Incoming message" trigger will run every time any user sends a message to your Bot, or a new message appears in a group/channel with the connected Bot. Any commands that begin with the “/” symbol (e.g., /start) are ignored by the trigger and do not start an automation, even if there is a text after a command.

But you can enable some commands for trigger. To do this, open the trigger settings:

2022-08-16_14-49-15.png

Here you can list the allowed commands:

Telegram 6.png

As a result, if the bot receives a message with allowed command and text, it will also run a trigger. For example, it will pass the text /yourCommand Hello to the automation.

The trigger, together with a message text, receives other data too. Example: the name and ID of the user who sent the message and the chat ID where the message came from.

Telegram 7..png

Thus, you can set up additionally the trigger filters to run the automation:

  • from a certain text;
  • when a certain user in the group sends a message.
  • when it receives messages from a particular chat.

Click on the Filter icon to set up the conditions.

2022-08-16_14-52-25.png

In the Value drop-down list you can find From and Chat values. The From values mean who sends the massage. We recommend you to use it when you receive messages from a group. The Chat values mean the chat info (private chat with bot/group/channel).

Telegram 9..png

Be sure to use filters if your bot will be in multiple chats.

Read more about filter settings in this tutorial.

How the "Send Message" action works

The "Send Message" action allows you to send a message to the selected chat using any Albato trigger. The functionality is similar to our bot described here.

The difference is that a certain chat is no longer linked to a specific connection, it must be selected from the list in the action field.

Telegram 10.png

Next, you can select the markup type.

Telegram 11.png

You can also create a small text format, such as HTML, with pictures and links.

You can use this action with the Table lookup tool. For example, you can specify the managers to notify them about a new CRM deal. This will help avoid including all employees in one channel.

It will work like this:

  • You receive a new amoCRM event (e.g. the "New Task" trigger).
  • Using the Table lookup tool, Albato checks the name of the responsible user and replaces that name with the chat ID.
  • This responsible manager receives a notification in Telegram.

Telegram 12.png

Then set up the action. Select the result of the Albto Table lookup tool in the Chat ID field.

Telegram 13.png

Automation scenario examples

Let’s suppose you need to create a task in YouTrack. Send a message to the bot and it will create a task automatically.

Telegram 14.png

2022-08-16_14-56-18.png

Let’s imagine you need to specify users who send a certain phrase. To do this, set up a filter on the "Text" field with the "Contains" condition and specify the desired phrase:

2022-05-21_16-40-39.png

Use this filter with an action that creates a lead or a deal in a CRM system, as well as a record in Google Sheets. By doing so, you will not miss a single message, even with a lot of spam from users.


Telegram