How to use bot in telegram group


How to create a Telegram Chatbot

A chatbot is an automated multifunctional assistant, that can receive send and send triggered messages, and with SendPulse, your bot can save information as variables for future usage.

Follow the step-by-step instruction to create your first chatbot for Telegram messenger or connect an existing one to SendPulse for further configuration.

If you already have a bot, skip the first paragraph and take a look at the next section.

How to Create a New Bot for Telegram

Open Telegram messenger, sign in to your account or create a new one.

Step 1. Enter @Botfather in the search tab and choose this bot.

Official Telegram bots have a blue checkmark beside their name.

Click “Start” to activate BotFather bot.

In response, you receive a list of commands to manage bots.

Step 2. Choose or type the /newbot command and send it.

Step 3. Choose a name for your bot — your subscribers will see it in the conversation. And choose a username for your bot — the bot can be found by its username in searches. The username must be unique and end with the word “bot.”

After you choose a suitable name for your bot — the bot is created. You will receive a message with a link to your bot t.me/<bot_username>, recommendations to set up a profile picture, description, and a list of commands to manage your new bot.

To connect a bot to SendPulse you need a token. Copy your token value and find more information about connecting your bot to SendPulse in the last section of this article.

How to Find a Token for an Existing Bot

Step 1. Go to the @BotFather bot and send the command /token.

You will see buttons with any bots that you have created.

Step 2. Choose the one you need a token for so you can connect it with Sendpulse.

Copy the token value.

How to Connect a Bot to SendPulse

Go to the "Chatbots" section in your SendPulse account. If you have not previously had any channels connected, click Connect.

If you have already connected bots, go to the "Manage bots" section, and click Add bot. You can also click "Connect" next to the channel.

In the "Telegram" section enter your token from the necessary bot and click “Connect.”

In the next window click the “Subscribe” button.

You will be redirected to the Telegram app, click on the “Start” button and you will be subscribed to your bot.

Once you have successfully connected your chatbot, you will receive its welcome flow, the bot will appear in your list of bots, and you can start creating welcome and triggered flows, or bulk campaigns.

Note, any existing subscribers are not imported to your SendPulse chatbot auditory. After you connect your bot you can collect subscribers with a website widget or share the link to your bot t.me/<username> directly.

Connect your Telegram bot

Last Updated: 24.10.2022

How to Add a Telegram Bot to Telegram Group (2022 Tutorial)

In this tutorial, I will explain how you can add a Telegram chatbot to your Telegram group and automatically reply to messages in your group.

I will show you:

  • How the chatbot can only reply when you mention it
  • How the chatbot can respond to all messages in the group

P.S. In my Telegram Chatbots guide, I already explained how you can can create a chatbot (without using any code), so if you haven’t already seen that one, I highly recommend to read it 🙂

Let’s dive in!

Table of Contents

Create a Telegram Group

As already mentioned in the beginning, I created my own Telegram chatbot which can reply to simple questions such as “Can I order a pizza”:

So the first step we need to do, is create our own Telegram group.

If you are on a desktop, just install Telegram, click on the Pen icon in the top-left corner and select New group:

Here, you need to select the members you want to add (probably some friends/colleagues of yours), give a name to the group (for example “Bot Test”) and click on Create:

 

Add Telegram Chatbot to the group

Now we’ve created our Telegram group and we need to add our chatbot.

So, you can just go to your Telegram chatbot (mine is called “Pizza-DF-Bot”) and click on the Top Bar:

Then, you need to click on “More” and select Add to Group:

And select the Telegram group you want to add the chatbot to:

 

Only reply if you mention the Telegram Chatbot

Once you’ve added your Telegram chatbot to your Telegram group, and you mention it, you will probably see that the chatbot doesn’t automatically respond:

This is because the chatbot is not an admin of the group.

So, you need to click on the top bar of your Telegram group:

Click on Edit:

And then choose for Administrators:

Click on Add admin:

Select your chatbot:

And then give it all the rights it needs:

When you’ve done this, and you will ask a question and mention the chatbot again, you will see that it is responding now:

 

Let Telegram Bot respond to all messages in the group

Now, the chatbot is only responding when you mention it.

But what if you want the chatbot to respond to all messages in the group?

Then, we need to have a talk with the BotFather.

In Telegram, you need to search for “BotFather” and start a conversation with him:

The BotFather immediately gives you a list of commands that you can use to change the settings of your chatbot:

Now, you need to type “/setprivacy”, which is a command we can use to change the privacy settings in Telegram groups.

Then, you can select which bot you want to change:

Then, you will see that the privacy settings are set to Enable (by default), which means the bot only replies to commands and mentions. Now, if you just type in “Disable” or click on the button, you can disable this setting:

And if you go back to your Telegram group and say something (without mentioning the bot), you will see that the chatbot automatically responds:

 

Now It’s Your Turn

And that’s how you add a Telegram chatbot to your Telegram group.

Now I have a question for you:

Do you already use Telegram Bots in your Groups? And if not, why not?

Let me know by leaving a comment below!

  • Facebook
  • Twitter
  • LinkedIn
  • More

Adding a bot to a Telegram chat - to a group, channel or for private messages with a chat bot in Telegram

Publication date: 8/29/2022

5 minutes

to read

Products from this article: 9002 Chatbots are used by many businesses: they help automate routine work. At the same time, they do their job quite well. SaluteBot, for example, can not only give the user ready-made items to choose from in order to continue the dialogue, but also analyze the written text to find the right answer from the database.

In this article, we will tell you how to add a robot to a Telegram chat and how to set up its work according to a certain scenario.

How to add to Telegram

The Telegram bot is responsible for creating bots in Telegram! If you want to create a new robot, go through the following steps:

  1. Search for the BotFather profile or follow the link https://telegram.me/BotFather.
  2. Press the "Start" button in the chat.
  3. Enter the /newbot command.
  4. Specify a name - this is how users will see it in their contact list.
  5. Specify the system name: this is the login after the @ sign.

The system name must be unique, and the name can be repeated with existing ones.

When the bot is created, you will see the token. It is needed for integration with scripts. If you forgot to save the token, just write the /token command in the dialog with BotFather.

The basis for the chatbot has been created, and you can even write a message to it. But for it to work, you need to create a script for it. This can be done through the SaluteBot service.

SaluteBot setup and features

To create your own script and link it to the chatbot, register with Studio and log in to your account. We will be using the SaluteBot tool, which helps to create a scenario in map mode. Programming skills are not needed if there is no integration with third-party systems.

After that, register in the Jivo service, which will connect the robot with the scenario. To work, you need a professional account, the first 14 days you can use it for free.

Next, the procedure will be as follows:

  1. Go to Studio and click "Create Project".
  2. Select Applications - SaluteBot.
  3. Click Add Account and log in to Jivo.
  4. Give the project a name.
  5. Select "Custom Script", it's free to create a script in design mode.
  6. Next, you will be taken to the constructor, where you can assemble the desired script.

Here are the possibilities in the constructor:

  • Send text to the user (greeting, response to message or action).
  • Data request - if you need to clarify some information with the client, for example, name, phone number, order number.
  • Condition — the script must respond flexibly to the client's actions, so when you select one or another menu item, the bot will react differently depending on the configured condition.
  • Translation of the dialogue to the operator. If the bot does not cope with the question, it will automatically invite the operator to the chat.
  • Script call - for advanced scenarios, where data exchange with third-party systems is implied.

How to add to a group

The most common scenario for chatbots in a group is onboarding for new members and moderating messages for prohibited topics with warnings.

To use a telegram bot in a group, just select it as a new member: the robot we created is a regular separate account in the list of group members.

Here's what to do:

  1. Go to your Telegram group settings.
  2. Click the "Add Members" button.
  3. Find the bot by system name using @name.
  4. Click on it and then "OK" to add it to the telegram chat.

After the robot is added to the group, it will begin to work out the scenario that was put into it in the constructor.

In this way, you can use not only a self-created bot, but also any existing one.

How to add to a channel

In a channel, chatbots are used for delayed posts or as a channel guide. In order for the robot to create posts or otherwise act on behalf of the channel, you need to make it an administrator. Here's how to do it:

  1. Go to the Telegram channel, click on the three dots and select "Channel Management".
  2. Go to the "Administrators" section.
  3. In the search, find the bot by its system name using @name.
  4. Add him as an administrator and specify what permissions he should have. If you do not issue the required permission, then some functions may not work.

You can add your own bot to the channel or select an existing one.

For private chats

If you don't have a group or channel and don't need them for your tasks, you can use the bot in private messaging mode. This is possible immediately after it is created, you just need to write a message to it directly.

This type of use is perhaps the most demanded by businesses, because in private messaging mode the client can transfer his data, and if the dialogue is deadlocked, an operator will connect at any time.

Also, working with a bot directly allows you to test it before using it in a group or channel - this way you can check that all functions work as expected.

Products from this article:

How to send a message to a Telegram group


You can not only use the Aimylogic bots to send private messages to Telegram , but also add them to Telegram group chats .

We're assuming you've already created a bot script and know how to publish it to a Telegram channel, so here we'll only cover how to send messages to a group chat.

Prepare the script

First of all, as a start screen, add a text block to the script, into which you copy and paste: $rawRequest.message.chat.id

This screen must be topmost and leftmost for the bot to display this message first.

Add variables to the script

Also, your script must be able to send data to Telegram. To do this, they need to be written to a variable.

For example, let's add a block text to $var , with which we will write a message to the variable $message :

Link "Navigation after entering $message " to block Http request . The request method is GET .

Now create the request URL. Instead, you will need to paste the channel token that you received in BotFather into the URL.

https://api.telegram.org/bot/sendMessage

In the BODY field of the request, insert the following:

 { "chat_id": chat_id_number, "text": "$message" } 

chat_id_number will need to be replaced with the value that you will receive at the stage of activating the bot in the Telegram group .

You can also send any other variables you receive in the script. For example, like this:

 { "chat_id": chat_id_number, text: "client name: $name, phone: $PHONE, feedback: $feedback" } 

If you are sending other variables, make sure that they are actually filled in the script before sending the request.

Prepare an error message

Associate the variant "Completed with an error" with the block Text , where you write error $httpStatus

Associate the variant "Completed successfully" with the block Text , in which the message about successful data submission is placed , for example Thank you, your application has been sent!

Prepare a group in Telegram for the bot

Now you need to create a group to which you want to add the bot and activate it.

Create a Telegram group

Create a Telegram group by selecting Create group from the menu and give it a name:

Add at least one member to the group and click Create and then add your bot to the group. To do this, press Add members . Type the name of the bot in the search, select the bot and click Invite :

Activate the bot

Send the command /start to the group. The bot will send you a message from the character set. You will need this value, including the sign - , later:

Add a bot to an existing group

If you already have a group in Telegram that you want to add a bot to, you need to:

  • Create chat with bot
    • The link to the bot is in BotFather , in the message in which you received the bot token
  • Go to the bot dialog menu and select Add to group . Follow directions
  • Now you need to allow the bot to read messages in the group. For this:
    • Go to BotFather
    • Write command /mybots
    • Select the desired bot
    • Go to Bot Settings → Group Privacy
    • Select Turn off
    • The phrase Privacy mode is disabled for Bot should appear

Delete $rawRequest

Return to the bot script.

Now you can delete the block that contains $rawRequest.message.chat.id .

Publish the bot

Publish the bot to Telegram and wait for publication:

Test the bot

Now write to the Telegram bot (not in a group). The link to the bot is in BotFather , in the message in which you received the bot token.

Start a new session with /start , send a message to the bot and make sure it comes to the group:

If your users write to the bot, messages from them will also be published in the Telegram group .


Learn more