20.09.2022
14054

How to Connect Telegram as Data Source (text, files)

How to Connect Telegram as Data Source

The integration allows you to get messages from Telegram, transferring data for them to other systems. For example, you can transfer new messages to GoogleSheets or CRM. This will allow you to maximize the automation interaction of Telegram with other services and systems.

Let's go through the entire Telegram setup steps together!

Navigation:
1. What data can I get from Telegram?
2. How to connect a Telegram account to ApiX-Drive?
3. An example of data on a new message.

To start setup click "Create Connection".

How to Connect Telegram as Data Source | Create Connection

Select a system as the Data Source. In this case, you must specify Telegram.

How to Connect Telegram as Data Source | System selection

Next, you need to specify the action "Get MESSAGES (new)".

How to Connect Telegram as Data Source | Action selection

The next step is to select the Telegram account from which will get the data.

If there are no accounts connected to the system, click "Connect account".

How to Connect Telegram as Data Source | Account connection

Fill in the fields with the appropriate data, where:

- Token - a token for connecting your Telegram bot.

  1. Create a new bot or use an already created bot.
  2. How to create a new bot is described here - https://core.telegram.org/bots#6-botfather
  3. To find out the Token of an already created bot, you can write the /mybots command in BotFather . Then select the bot you need and click on " API Token ". Copy the Token and paste it into the appropriate field in the ApiX-Drive system.

Note!

In the Access section, you can connect a private chat, channel or group, for this you need to create your bot and add it as an administrator so that it has read access rights. This action works with text and files as well.

If you have previously connected your bot to other services, you need to disconnect the first connection and reconnect the bot or create a new bot.

After entering the token in the required field, click "Save", by doing this you confirm the removal of the previously installed webhook in the specified bot, and also consent to the installation of the ApiX-Drive webhook.

How to Connect Telegram as Data Source | Account connection

Please note that if the desired access is not listed, follow the steps described when connecting, namely, write something directly to the bot and click the "Update" button.
In the case of a channel or group, add the bot and click the "Update" button. If the bot was added previously, it must be added again.

Note!
If you want to get new messages from a Telegram bot that is connected to a group, you need to go to the settings of your Telegram bot in the BotFather chat.

BotFather Chat Sequence:

1. Write the /setprivacy command . In response, BotFather will ask you to select a bot to change your group messaging settings. You can select a bot from the menu, or write your bot's name like this @your_name_bot .

2. Next, BotFather will write this text to you:

'Enable' - Your bot will only get messages that either start with a '/' or mention the bot by username.

'Disable' - Your bot will get all messages that people send to groups.

Current status: ENABLED

You need to press " DISABLE ". After that, you will be able to upload new messages to the Telegram bot that is connected to the group.

How to Connect Telegram as Data Source | Account connection
How to Connect Telegram as Data Source | Account selection

When the connected account is displayed in the "active accounts" list, select it for further work.

Note!

If you get this error:
Conflict: can't use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first

This means that your bot is connected via Webhook to another system. To disable it, you need to write in the search bar of your browser: https://api.telegram.org/botHere you need to write the Token of your Telegram bot/getWebhookInfo  

If there were connections, then just instead of getWebhookInfo , write deleteWebhook and hit search.

How to Connect Telegram as Data Source | Settings

If necessary, you can set up a Data Filter, or click "Continue" to skip this step. 

To find out how to set up the Data Filter, follow the link: https://apix-drive.com/en/help/data-filter

How to Connect Telegram as Data Source | Data Filter

Now you can see the test data.

How to Connect Telegram as Data Source | Data Test

If the test data does not appear automatically, click "Load test data from Telegram" or try to generate actions in your Telegram that the connection is set up to work on.

If everything suits you, click "Next".

How to Connect Telegram as Data Source | Go to setup the Data Destination 

This completes the entire Data Source setup! See how easy it is!?

Now you can set up the Data Destination system.

To do this, set up it yourself or go to the help section "Data Destination", select the service you need as Data Destination, and follow the setup recommendations.

Good luck!