How to make Telegram bot with OpenAI without code

Solution: Telegram bot with OpenAI
Telegram
·
3/30/2023
·
3 min. read

If you want to set up a Telegram bot that works seamlessly with ChatGPT, we've got you covered. Our solution allows you to get up and running in no time, with minimal configuration required. Simply follow the link provided below, and we'll guide you through the process step-by-step. It couldn't be easier!

⭐️ You can also watch the video instruction on our YouTube channel

Learn how to build a Telegram bot with ChatGPT in just 3 minutes

The bot uses API requests to interact with Telegram and OpenAI. You don't have to write a single line of code to send requests; Albato will do that for you! Just choose from pre-made blocks to create the scenario you need and start integration. If you want to create a scenario for another app or system, Albato can help without requiring any programming skills. Let's get started!

Option 1. Use the Solution.

Time to create: 2-5 minutes

We have prepared a solution that consists of three automations.

1.png

How to install the Solution

The solution can be installed via the link or you can go to the Solution section in your Albato account.

How to set up the Solution

First, you need to create a Telegram bot. It's a quick and free process that doesn't require much skill. All you need to do is visit https://t.me/BotFather and send the command /newbot. From there, you can set the bot's name and description. Once the bot is created, you'll receive an API token that you can easily copy. (For more detailed instructions, check out this helpful link.)

Next, go to OpenAI - a neural network which will receive our text and commands. Choose "API" in the menu and sign up. After registration, you'll get a $18 credit, which should be enough to get started. To obtain the API token (password to connect to the API), click on the "Personal" tab in the top right corner. From the drop-down list, select "API-keys" and copy the key. Then, paste it into the OpenAI connection settings in Albato. (For more detailed instructions, check out this helpful link.)

The bot is ready! Automation has been set up according to the template, so you can use the bot or customize it a bit before launching. For example:

  • In scenario 3, set up a welcome message, explaining how the bot works (AI, followed by text; in our example - AI, hello, examples of marketing automation).
  • In scenarios 2 and 3, configure the fields in the OpenAI step, specifying the Max tokens (default is 2000), and we'll cover the other OpenAI fields below.

If you don't have an account with OpenAI, there's a special tool in Albato called AlbatoAI that lets you set up similar integrations with Telegram bots. Join our Facebook community, share your thoughts, and our team will respond to help you build your customized automations!

Option 2. Use the Automation Builder

Go to the Apps section in you Albato account. Click on the Add a connection button. Choose Telegram (private) and OpenAI in the list and connect the apps to Albato. To connect the apps, you will need the tokens that you copied earlier.

2023-03-24_10-58-59.png

Create your bot by integrating the apps you need.

2023-03-24_11-04-47.png

Use triggers in the form of incoming Telegram messages that will be sent to your bot. The next step is to send the received message to OpenAI. After receiving the response, return it to Telegram as well.

2.png

In the OpenAI settings, you can choose: the neural model (depending on the command), the number of tokens in response, and "creativity". You can read more about the parameters on the OpenAI website in the Examples and Documentation section.

Untitled.png

To make sure the bot follows our commands, add "Filter" to the automations.

2023-03-24_11-29-41.png

What other parameters can be configured?

temperature: this is a parameter that regulates the creativity of responses.  Values close to 1 will give the model more risk/creativity. And values close to 0 will generate well-defined responses.

max_token: the maximum number of tokens to generate at completion (here you can see the tokenizer that OpenAI uses)

💡 Token is a part of a word that is used for natural language processing. 1 token is about 4 characters or 0.75 words. You can read more about tokens in the article — What are tokens and how to count them. And then find out about the plans.

number of results: the number of response options to be generated for each input message.

The main difference from the previous models is the Messages object where we have roles that we define in advance.

Due to this, the content (that is, the context of the conversation itself and the entire dialogue) can be built both from a single message and from remembering previous messages.

5.png

Read this article for more information on OpenAI (ChatGPT) integration options.

You can create a scenario using a neural network or other apps of your choice. The possibilities are endless, and we encourage you to unleash your creativity!

Alternatively, if you'd like our team to help you implement a custom scenario, simply reach out to us via our help chat. We're always happy to assist, and our services are completely free of charge.


Telegram
OpenAI