KWIGA help center LMS (education) Creating private groups How to create and connect a Telegram chatbot

How to create and connect a Telegram chatbot


Learn more about setting up and connecting Telegram bot

In this article:

When setting up a closed group in Telegram, you will need to connect a bot. It is needed in order for a member to could receive payment notifications, as well as associate a contact on Kwiga with a member in Telegram, and in the future for mailing lists and other notifications in Telegram. Adding members to the group and removing from the group will occur automatically. You can use both an existing bot and create a new one that will only be used for a specific closed group, or for all alerts in your project. The most common is the use one bot for all notifications for your project.

Create a bot

Open a chat with @BotFather (go to link).

If you have not previously communicated with this bot, then type /start and then the command /newbot.

The bot will ask you to come up with a name for your bot. This is the name that will be displayed in the contact list (in our example - kwiga example)

Then you need to come up with a username for the bot - this is a unique name, you can use it to find the bot in Telegram, and it must end with bot (in our example KwigaExample_bot).

After that, the bot will be created and you will receive information on how to add a description, an avatar, a link to the bot itself, and the most important thing is the token, which is necessary for this bot to be able to send notifications.

Getting the token of the previously created bot

Open a chat with @BotFather (go to link). Enter the /token command and select from list token for which bot to show:

After choosing a bot (for example, @alanaschool3_bot) you will receive a token.

Go to the creation of a private group, at the step Alert bot settings, you need to fill in 2 fields: name and token.

Create a group or channel in Telegram

Telegram offers two types of ways to communicate with its subscribers: a channel and a group. All members in the group can send messages, while only the channel administrator can write messages in the channel.

Depending on your goals, create a group or channel. The examples below will describe the group settings as more popular instrument.

Pay attention! You can connect a previously created group to Kwiga, where there are already members, but the work will be incorrect, due to restrictions in Telegram. The bot will not be able to remove or add members who are in the group before setting up work on Kwiga.

Adding a bot to a group

Open the group you just created and select Manage Group.

Choose add Admin, enter your bot name and add it as an admin. Make sure you're right The bot has Adding and removing users.

After that, write the /chatid command and the bot will show the number that you need to indicate to Kwiga.

Other settings

You can set other settings in the group as you like, they do not affect the performance of the group.

Public group or Hidden - after adding the bot to the group, it will control all new users in group. If the user does not have access to the group, then the bot will delete him as soon as he is added, so you can make the group public or hidden - it will only contain those members who have received or paid for access.

Whether the chat history in the group is visible to newly connected users, whether users can save content - that's all you You can customize or change at any time.

What group members can do and how often to post.