No Coding Required: Integrate ChatGPT with Telegram in Minutes.

Abraao Lima
6 min readJan 23, 2023

--

In recent weeks, I’ve been experimenting with the powerful language model, ChatGPT. I’ve found it to be a fun and engaging tool to work with, and I’ve been impressed by its capabilities. As I delved deeper into the world of ChatGPT, I came across an article about integrating it with WhatsApp. Intrigued by the possibilities, I decided to take it a step further and explore how to integrate ChatGPT as a Telegram bot.

Integrating ChatGPT with Telegram seemed like the perfect solution for those who want to have quick and easy access to the power of the language model without having to log in to the website. However, I realized that not everyone has programming skills and may find the process of integrating ChatGPT with Telegram to be a bit daunting. That’s why I’ve decided to write this article. My goal is to teach people how to integrate ChatGPT as a Telegram bot using a no-code tool to simplify the process. This way, even those without any programming experience can have a easy way to ask ChatGPT on the run.

In this article, I will be providing step-by-step instructions on how to set up a Telegram bot that utilizes ChatGPT’s capabilities. I will also be discussing the benefits of using a no-code tool to simplify the integration process. Whether you’re a programmer or not, this article is designed to help you get started with ChatGPT and Telegram, and to show you just how easy it is to have a powerful language model at your fingertips. So, let’s dive in!

Steps:

  1. Get OpenAI API token
  2. Create Telegram Bot
  3. Create a Make Account (No-Code tool)
  4. Put it all together

1. Get OpenAI API token

Access the following URL while logged into your ChatGPT account to create the access token that be will be needed later on:

Save the generated token and also the "Organization ID" that can be found on the left side panel "Settings".

2. Create Telegram Bot

Creating a Telegram bot is a relatively simple process that can be done in a few steps. Here is an overview of the process:

  1. First, you will need to have a Telegram account and download the Telegram app on your device.
  2. Next, you will need to create a new bot by talking to the “BotFather” on Telegram. To do this, open Telegram and search for “@BotFather” in the contacts search bar. Start a conversation with him and type “/newbot” to create a new bot. The BotFather will ask you to choose a name and username for your bot.
  3. Once the bot is created, the BotFather will provide you with a unique token that you will use to access the Telegram bot API.
  4. Save the token generated by the Bot for when we setup the integration.

You can also follow this video tutorial to create the Bot:

3. Create a 'Make' Account (No-Code tool)

Make is a powerful automation tool that allows users to connect different apps and services together to automate repetitive tasks and workflows. It allows you to create custom integrations, called “scenarios”, that can include triggers (events that initiate the automation) and actions (tasks that are performed automatically in response to the trigger). Users can also add filters and other logic to customize the behavior of the integration. Integromat can be used to automate tasks such as data transfer, social media management, and e-commerce automation.

You can use the following link to create an account and it will also help me to continue creating posts like this 😊.

https://link.abraaolima.dev/make

4. Put it all together

Let's start by creating a new Make Scenario, clicking on the ‘Scenarios’ menu option on the left hand side panel and then clicking on the button 'Create a new scenario' on the top right corner to start configuring the automation.

To view the list of integrations/apps, press the purple button in the middle of the screen, then filter the list by typing ‘Telegram’ and selecting the ‘Telegram Bot’ item. A new list of the Module actions will show up, scroll until you find the 'Watch Updates' option and select it.

A 'Webhook' configuration box will be shown, click on the 'Add' button:

On the 'Token' field we need to enter the Telegram Chat Bot Token we created before on Step 2 and then just click on the 'Save' button.

Now let's add a new module by clicking on click the ‘+’ icon on the edge of your existing module, search for ‘OpenAI’, and select the ‘OpenAI GPT3’ option. We will use the ‘Create a Completion’ action from the OpenAI module in this case.

Now let's setup the OpenAI connection by clicking on the 'Add' button and entering the 'API Key' and 'Organization ID' that we got on Stage 1.

Now we can proceed setting up the OpenAI module with the missing parameters it requests, which are:

  • Model: text-davinci-003
  • Prompt: We associate it with the Text coming from Telegram
  • Max Tokens: 4000
  • Temperature: 1

Once this module runs we'll have the response from OpenAI and then we just need to send it back to our Telegram chat.
To do that let's add a new Telegram Module after the OpenAI one but this time with the 'Send a Text Message or a Reply' action.

The parameters needed to make it work are:

  • Chat ID: Get the value from the previous Telegram module > Message > Chat > ID
  • Text: Get the value from the OpenAI module > Choices[] > Text

Hit the "Run" button on the bottom left corner of the screen, type a question on your Telegram Chat bot conversation and you should see the response right after it. If everything works fine enable this scenario switching the button below the 'Run' button to 'ON' and that should be it. 🎉

Conclusion

You just unlocked the Power of Natural Language Processing right from your Messenger app, hope you like it.
If you need any help don’t hesitate to ask on the comments below and if you need assistance building new Make scenarios of any kind send me an email at contact@abraaolima.dev or book a time for a quick conversation following this link.

--

--

Abraao Lima

Writing about AI, No-Code and Programming in general.