Message link parser

A Telegram message link already contains the chat ID and the message ID. Paste it to split it into the values the Bot API wants.

Link → IDs

Paste a link to a message. Private links (t.me/c/…) are decoded here; nothing is sent.

IDs → link

Build the link to a message from what your bot received.

How the link is built

Private chatt.me/c/<channel>/<message>chat_id = −100 followed by <channel>
Forum topict.me/c/<channel>/<topic>/<message><topic> is message_thread_id
Public chatt.me/<username>/<message>chat_id = @username (or look the number up)

Use it

Copy a message into another chat with the values from the link:

curl -s "https://api.telegram.org/bot$TOKEN/copyMessage" \
  -d chat_id=<target chat> \
  -d from_chat_id=-1001234567890 \
  -d message_id=45

FAQ

How do I get the chat ID from a t.me/c link?

Take the first number after /c/ and write −100 in front of it. t.me/c/1234567890/45 is chat_id −1001234567890, message_id 45.

What are the three numbers in t.me/c/123/7/45?

The channel's ID, the topic (message_thread_id) and the message ID. Links with two numbers after the chat belong to forum topics or comment threads.

Why does my private message link not open?

t.me/c/… links only open for accounts that are members of that chat. They also exist only for channels and supergroups; basic groups and private chats have no message links.

Can I use the link's numbers with copyMessage or forwardMessage?

Yes. Pass the chat_id (with −100) as from_chat_id and the last number as message_id. The bot must be a member of the source chat.