logo
การพัฒนา
ค้นหา
Telegram

Telegram

You can integrate the GPTBots Agent into a Telegram Bot (TG Bot), allowing your Telegram users to interact with the Agent through the TG Bot.

Telegram currently supports three types of Agent and user interactions:

  1. Private Chat: Agent and user communicate one-on-one
  2. Group Chat - Passive Listening: Agent only responds when the user @mentions the TG Bot
  3. Group Chat - Active Listening: Agent continuously listens to all user messages and responds

Create a TG Bot

image-20240827142507746

Go to BotFather, enter the /newbot command, and follow BotFather’s instructions to create a TG Bot.

Once created, you will obtain the TG Bot link (Telegram Agent Link) and token.

Configure in GPTBots

image-20240827143504008
alt text
Go to GPTBots, enter Integrations - Telegram, toggle the switch, and open the Manage page. Click Add TG Bot.

alt text
Enter the token obtained from BotFather and click Verify at the bottom.

alt text
After successful verification, the fields above will refresh with the avatar and name (Username) set in your TG Bot. Once confirmed, select the chat mode for this TG Bot to respond to, then click Submit.

Note: To use the Active Listening feature, you must first configure both Listening Frequency and Listening Rules. For detailed instructions, see the section at the bottom.

alt text
After submitting successfully, the system will provide the TG Bot link (Telegram Agent Link). This link can be shared with your users, who can use it to access the TG Bot and start chatting with it.

Update Agent introduction

alt text
Click Update Agent introduction to update the current description of the Agent to all TG Bots.

Private Chat in Telegram

alt text
Enable the Private Chat button.

When users access the Telegram Agent Link, they can chat with the Agent directly in Telegram.

Group Chat in Telegram (Passive Listening)

Group Chat (Passive Listening): The Agent only responds when the user @mentions the TG Bot.

Setup Tutorial

alt text

First, in BotFather, change the TG Bot’s group chat permission to Passive Listening mode.

  1. Enter setprivacy
  2. Enter the TG Bot whose group chat permissions you want to adjust, such as “@YourBotName”
  3. Follow the instructions and enter Enable
  4. TG will return Enable, which means Passive Listening has been successfully enabled

image-20240828113324404

Next, open the TG Bot’s profile page and click Add to Group or Channel.

image-20240828113209520

Choose the group to which you want to add the TG Bot.

image-20240828113427750

Keep using Admin Rights to provide the TG Bot with full permissions, then click Add Bot as Admin to complete the process of adding the TG Bot to the group.

alt text
Next, go back to the GPTBots Telegram integration page and click Edit.

alt text
In Group Chat mode, select Passive Listening, click Save, and the setup is complete.

Group Chat in Telegram (Active Listening)

Group Chat (Active Listening): The Agent continuously listens to all user messages and responds.

alt text

Complete process: The system collects group chat messages at intervals based on the configured Listening Frequency and stores them in the staging area. The messages are then matched against Listening Rules, and if a match is found, the group chat messages are forwarded to the Agent for response.

Setup Tutorial

alt text

First, in BotFather, change the TG Bot’s group chat permission to Active Listening mode.

  1. Enter setprivacy
  2. Enter the Agent whose group chat permissions you want to adjust, such as “@YourBotName”
  3. Follow the instructions and enter Disable
  4. TG will return Disable, which means Active Listening has been successfully enabled

image-20240828113324404

Next, open the TG Bot’s profile page and click Add to Group or Channel.

image-20240828113209520

Choose the group to which you want to add the TG Bot.

image-20240828113427750

Keep using Admin Rights to provide the TG Bot with full permissions, then click Add Bot as Admin to complete the process of adding the TG Bot to the group.

alt text
Next, go back to the GPTBots Telegram integration page and click Edit.

alt text
In Group Chat mode, select Active Listening. Active Listening requires two settings.

Step 1: Adjust the Listening Frequency. Listening Frequency determines how often the system collects group chat messages. The shorter the interval, the more frequently the Agent responds.

Step 2: Configure the Listening Rules. Click Set Listening Rules.

Note: Both Listening Frequency and Listening Rules are required. You must configure both to enable Active Listening.

alt text

Listening Rules provide three options:

  1. Keyword Match: Supports regex. Only when a group chat message matches a keyword in the list will the message be forwarded to the Agent.
  2. Semantic Match (Normal): The LLM checks messages against the list of keywords. If a match is found, the message is submitted to the Agent for response. Normal mode: fast speed, low credit consumption, moderate accuracy.
  3. Semantic Match (Advanced): The LLM checks messages against both keywords and descriptions. If a match is found, the message is submitted to the Agent for response. Advanced mode: fast speed, high credit consumption, high accuracy.

After selecting a matching rule, add keywords and descriptions in the list below.
alt text
alt text
After filling in the keywords and descriptions, make sure to toggle the enable button, then click Confirm. Next, go back to the Set TG Bot popup and click Save. The Active Listening setup is now complete.

alt text
If you need to adjust the content of the Listening Rules later, you can also click Listening Rules in the page to modify them.

Note: Using the Semantic Match feature in Active Listening mode may consume a large number of credits. To avoid high credit consumption, use Keyword Match instead.