Get started for free
Database and API-builderVisual developmentIntegrations
Why Directual
For developersFor product ownersFor freelancers and agenciesFor startups
Terms of servicePrivacy policy

Directual + Telegram messenger

← Explore other integrations

What is Telegram

Telegram is a messenger. There is an opportunity to create sophisticated chat-bots on that messenger. Let's figure out how you can create the Telegram-bot on Directual!

Step 1. Create a bot

In Telegram messenger we go to BotFather and type /newbot

Secret token is red. Here on the screenshot it is masked partially :)

BotFather gives to us an HPPT API secret token (red one).

Step 2. Connect your bot to the app

Go to Directual app, and then to Integrations section:

Add our bot (button 'New messenger') and insert the secret token we've copied.

That is it! We have established the integration though.

Step 3. Figure out the purpose of Telegram structures in Directual

Go to Database section, Integrations / Telegram folder (it appears automatically). Here we see 5 data structures:

  • Incoming Telegram messages (system name TMessageIn). Stores all messages that users have sent to the bot.
  • Outcoming Telegram messages (system name TMessageOut). Stores all messages that the bot have sent to users.
  • Users Telegram (system name TUser). Stores Users who have sent messages to the bot.
  • Chats Telegram (system name TChat). Stores Chat-objects. That is the object which is used by scenario Telegram step as a 'destination'.
  • Keyboards Telegram (system name TKeyboard). Stores Telegram 'keyboards'. We create these objects manually. TKeyboard is used by scenario Telegram step when we want to suggest some answers to the user.

We'll figure out all the details cencerning TChat and TKeyboard further in this manual.

The new System scenario has appeared (you shall not edit it)

Step 4. Test the integration

Now all the messages, chats and users appear in your data structures:

Note that in Message objects we have links, including link to Chat:

Let's create a simple scenario for dealing with Incoming Telegram messages. We choose the target data structure TMessageIn and the trigger: Real-time: New

This scenario will react as soon as a new Telegram message comes.

Then let's compose scenario with only one step:

Let's setup this step. In the field ChatKey we choose the property chatKey of the processed object. Remember—each TMessageIn contains the ID of TChat. We could choose the other value here — we'll do it in Step 7 of this tutorial.

And then— Publish and Run our scenario

Let's try it out:

Step 5. Add a keyboard

Let's add a keyboard to our Bot!

  • We are creating new object in TKeyboard structure.
  • Fill the id. It is a key to our object (we'll use it setting up the step further).
  • Field keyboard contains options for the users answer.

For example:


  • Go to our scenario;
  • Switch to running view;
  • Open Telegram step configuration;
  • Choose Type of message — Keyboard;
  • Enter id property of the object we've just created in TKeyboard structure;
  • Save;
  • Publish!

And here we are:

Step 6. Get to know the 'context' property

The content is being prepared...

Step 7 (optional). Figure out how to connect users through the bot

The content is being prepared...

← Explore other integrations

Have questions? Visit our community forum.