Types of VideoChatParticipantsInvited in the Telegram Bot API

telegram bot api videochatparticipantsinvited
14 March 2025

Introduction to VideoChatParticipantsInvited in the Telegram Bot API

Hello! Today we want to talk about one of the different types existing in the Telegram Bot API. This specific type is called VideoChatParticipantsInvited and is used specially during a video chat invitation. In fact, when you start a video chat and new participants are added to your chat, this type of data is created.

Video chat messages in Telegram are very attractive and useful, especially for large groups or online meeting arrangements. By using the Telegram Bot API, you can track various trends and events that occur in these messages. One of these events is an invitation from new users to a video chat, which is identified by VideoChatParticipantsInvited.

However, let’s take a look at how to use this type and the relevant data associated with it. When a user is invited to a video chat, information such as the username and their name is recorded in this type of data. This data can automatically be sent to your bot to allow you to perform suitable reactions. For example, you might send a message to the group indicating who has been added to the chat.

In general, utilizing the type VideoChatParticipantsInvited allows you to provide a better user experience for group members by informing them. Now let’s move on to the code and examine how to implement this feature in Telegram bots.

const TelegramBot = require('node-telegram-bot-api');
const token = 'YOUR_BOT_TOKEN';
const bot = new TelegramBot(token, { polling: true });

bot.on('video_chat_participants_invited', (msg) => {
const chatId = msg.chat.id;
const invitedUsers = msg.new_chat_participants;
invitedUsers.forEach(user => {
bot.sendMessage(chatId, `A user named ${user.first_name} has been added to the video chat!`);
});
});

Code Explanation

In this section, we will line-by-line review the above code.


const TelegramBot = require('node-telegram-bot-api');
This line imports the Telegram Bot library into your project to enable its functionalities.

const token = 'YOUR_BOT_TOKEN';
Here, you will input your bot's token which allows you to connect to the Telegram API.

const bot = new TelegramBot(token, { polling: true });
This line creates an instance of your bot and enables polling to receive real-time updates.

bot.on('video_chat_participants_invited', (msg) => {
Here we listen for the event of an invitation from users to a video chat, when this event occurs, the function will execute.

const chatId = msg.chat.id;
This line extracts the chat identifier from the incoming message.

const invitedUsers = msg.new_chat_participants;
This extracts the new users who have been invited to the chat.

invitedUsers.forEach(user => {
This line allows us to perform an action for each new user that has been invited.

bot.sendMessage(chatId, `A user named ${user.first_name} has been added to the video chat!`);
Finally, this sends a message to the chat to indicate who has joined.

FAQ

?

How can I receive information about new users invited to the video chat?

?

Can I send a welcome message for new users in the video chat?

?

How can I configure my bot for video chats?