0

I have been looking for a way to add a number of users to a telegram channel (with users id) for a long time and I didn't find anything. (I'm sure there is such a thing because I know people who do it but IDK and they don't tell me how it is done).

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40

1 Answers1

1

First of all, please note that only the first 200 members can be added to a Telegram channel, and you should be aware that you are subject to get limited or banned if you abuse the Telegram API.

You can add members to a Telegram channel by calling the channels.inviteToChannel method.

If you use Python, you can do that easily with Pyrogram:

client.add_chat_members(
  channel_id,
  [user_ids],
)

You can also call the method easily with GramJS, if using JavaScript:

client.invoke(
  new Api.channels.InviteToChannel({
    channel: channelId,
    users: [userIds],
  })
)
Roj
  • 995
  • 1
  • 8
  • 22
  • Is there any way to add a bot to a channel? I use `GramJS` to create a channel programatically. Then, I wanna add a bot to the newly created channel. For this, I use `InviteToChannel` method, but it doesn't work. It crashes with the error `RPCError: 400: USER_BOT (caused by channels.InviteToChannel)`. Any ideas, folks? – dobeerman Apr 19 '22 at 15:55