1

At first i should emphasis that this is a question about telegram GROUP NOT CHANNEL.I need to get group id to send message via telgram api.
I have review this link .
using @rawDataBot needs to add bot to group, that is not possible most of the times. CuteGram does not login (does not send login code) .so i can say none of the proposed method works.

so is there a new method -except adding a bot to the group- to get telgram group ID ?

if the answer is no, i need to know if it is possible to send message to group by using group name?!

alex
  • 7,551
  • 13
  • 48
  • 80
  • 2
    It's not possible with Bot API without joining the group. You should instead use an mtproto client like telethon https://docs.telethon.dev/en/latest/ to get the dialogs in your telegram and match the group name, and then get the id. – Ali Padida Dec 01 '20 at 07:07

4 Answers4

2

the easiest way is to add @chatBotRaw the bot will dump raw data, and you can copy their chat_id or anything else you need,

Remember to remove the bot afterwards because it dumps raw data of every message sent/received in the group.

Razor Mureithi
  • 351
  • 1
  • 4
  • 15
1

the simplest way i found is

  • open web-telegram in a browser
  • right click on the group name on the left menu
  • click 'inspect' button
  • you will see the group id in the attribute data-peer-id="-xxxxxxxxxx" or peer="-xxxxxxxxxx"
zakaria35
  • 857
  • 1
  • 7
  • 12
0

You can get chat id throw object "chat"
You can set middleware which handle new update
Example on Node.JS: bot.on('text', ctx => console.log('Chat id is:', ctx.chat.id))
P.S. group id and chat id are same

0

if using a bot is acceptable, you can use @username_to_id_bot - no need to add it to a group, just send username or invite link and get the id

crystalbit
  • 664
  • 2
  • 9
  • 19