Alex Zhukovskiy
Alex Zhukovskiy

Reputation: 10035

Link message by message_id via telegram bot

I'm writing a simple bot and I want to basically link together two messages. I found that I could link one by replying on it, so it works like a charm. But now I want to insert a link to another message. And here is a problem, the only way to make a link I found is post link like https://t.me/{chat_name}/{message_id}. But it doesn't work for chats that don't have chat_name.

How could it be done?

Upvotes: 6

Views: 5907

Answers (1)

MrModest
MrModest

Reputation: 337

Usually worked this pattern: https://t.me/c/{chat_id}/{message_id}, but it worked for me when I sliced chat_id (skipping minus and first 3 digits). For example on JS: message.chat.id.toString().slice(4).

So, for message with chat_id: -1001473943182 and message_id: 5 link would be: https://t.me/c/1473943182/5.

But it work only for chat.type = 'supergroup' as I see and chat must have join link probably.

Upvotes: 11

Related Questions