About This Guide
Artificial intelligence is becoming an integral part of our lives, demanding convenient and fast usage. If you’re looking for an easy way to use AI without additional apps or want to have your own AI bot, we have the solution for you. All you need is our DigitalBPM service, which helps you quickly integrate ChatGPT with your Telegram bot (or another messenger).
Who Is This Guide For?
For everyone who dreams of creating their own personal AI assistant on Telegram, regardless of their programming level. The DigitalBPM service will help you from the first steps to creating a functional bot.
Before you start creating an assistant, make sure you have everything you need:
- A DigitalBPM account.
- A Telegram account and bot. You can read our guide “Create the first Telegram bot” if you don’t have a Telegram bot.
- A ChatGPT account with API tokens.
If you’re ready, let’s get started!
Create a new workflow and first block
1. The first thing you need to do is to sign in to your DigitalBPM account and click on the “+ Workflow” button on the “Automation” page.

2. Next, you need to enter a name for your workflow, for example, “AI assistant for Telegram” and click “OK”.

3. After confirming the creation of a workflow, its builder opens. To add the first block, click the “+ Add first block” button.

4. Next, you need to configure the first block. This block is responsible for the instant trigger of the workflow when new messages are received in Telegram. To do this, click on it to open the “Block Configuration” panel. And select the “Webhook“ block type.

5. The first service to add is Telegram, so you need to click on the “2. Select trigger app“ field and find, and select the Telegram service.

6. Next, you need to connect your Telegram bot with the DigitalBPM service. To do this, click on the “Sign in“ button.

7. In the pop-up that appears, you need to fill in the name field for authorisation and the token that was received when creating the Telegram bot. To connect, click the “Save“ button.

8. The next step is to select an event, so click on the field “4. Select an event“. Find and select the “Webhook create“ event.
The selected event allows you to track new messages on Telegram by the token of the added bot.

9. Click on the “Name“ field and fill in a clear name for what happens in the block, for example, “Start workflow with a new message“. With this step, you can quickly find out what the block is for.

Add integration with ChatGPT service
1. Next, you need to add a block with the ChatGPT service to process the message received from Telegram.
To add a new block, click on the “+“ button to the right of the existing block.

2. In the “Block Configuration“ panel, click on the “1. Select block type“ field and select the “Execute” type.

3. Next, you need to add the ChatGPT service by clicking on the field “2. Select trigger app“; find and select the ChatGPT service.

4. To connect to ChatGPT, you need to create an authorisation. Click on the “Sign in“ button in the “3. Select an account“ section.

5. In the pop-up, fill in the name field and the API-key that was generated in the OpenAI developer account. To connect, click the “Save“ button.

6. The next step is to select a method, so click on the field “4. Select a method”. Find and select the “Create chat” method. The selected method creates a chat, sends a message from Telegram to ChatGPT, and returns a response from ChatGPT.

7. Add a list of messages that comprise the conversation. In the added object, fill in the fields: role – the role of the author of the message; name – the name of the author of this message. Name is required if role is function, and it should be the name of the function whose response is in the content. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.

8. Next, fill in the field content – the contents of the message. Content is required for all messages.
To do this, click on the “content” field and expand the block with the Telegram service in the “Variables” panel.

9. In the expanded list, find the variable “message.text“. To add the variable to the field, click on the variable name “text“.
Click the “Save” button to save the configured fields. This step is necessary to avoid accidentally losing the settings.
For reference, see the image below.

10. Next, enter the identifier of the language model you want to use. For example, let’s use the “gpt-3.5-turbo” model. After all the required fields are filled in, it is necessary to save the block settings by clicking the “Save” button.

Add the final Telegram block
1. The final step is to add a block that will send a response back to Telegram. To do this, add a new block by clicking the “+” button to the right of the second block (the block with the ChatGPT service). In the “Block configuration” panel of the new block, select the block type as “Execute,” and in the “Select trigger app” field, find and select the Telegram service.
Next, you need to choose authorization. It was created when setting up the Telegram service on the first block (Webhook). Therefore, you need to click on the “Select account” field and select authorization in the “Block configuration” panel.

2. Select the method to send a response from ChatGPT to the Telegram bot by clicking on the “4. Select a method” field. Find and choose the “Send Message” method.

3. Click on the “Chat ID“ field – Unique identifier for the target chat or username of the target channel.
In the Variables panel, expand the Telegram block and the Messages object. Find and select the “id” variable (message -> chat -> id).

4. Click on the “Text field” – Text of the message to be sent.
In the Variables panel, expand the ChatGPT block; find and select the “content” variable (body -> choices -> choice -> message -> content) – answer from ChatGPT. To display the first response, enter one in the square brackets of the added variable.

5. Let’s rename the second and third blocks to quickly identify their purpose later. To do this, select a block and, in the “Block Configuration” panel, enter a clear name in the “Name” field. For example, name the second block “Send a message from Telegram” and the third block “Sends a response from ChatGPT”.

Run to execute a workflow
1. Your workflow is now fully configured. Let’s try running it. To do this, click the “Run” icon in the top-right corner of the workflow builder and select “Run Live”, or use the keyboard shortcut “Shift+L“. If the launch is successful, the icon color will change from white to blue, and an “L” will appear next to it.

2. Congratulations! Your AI bot assistant in Telegram is ready. Go to your bot and use ChatGPT directly from the Telegram bot.

Stop the workflow
If you need to stop the automation, go to the running workflow, click the “Run” icon in the top-right corner of the automation builder, and select “Stop Live” or use the keyboard shortcut “Shift+L“.
