1

So, I have a topic link given by a user. I want to verify if that topic link is correct or not using Telegram Bot API

CallMeStag
7,1831 gold badge10 silver badges27 bronze badges
asked Jul 4, 2024 at 14:13

1 Answer 1

1

As of now, there's no API methods in Telegram Bot API to know if the link actually leads to a existing topic in a Forum chat.


But, a workaround I can suggest is you can try calling a send method such as sendMessage with passing the thread id. Remember, your bot must be in the specified chat (and need necessary permissions - if required) to send message.

If the topic does not exist, you will receive a exception from Telegram Bot API as follows:

{
 "ok": false,
 "error_code": 400,
 "description": "Bad Request: message thread not found"
}

So the workaround is something like:

  1. Send a test message
  2. If it fails with the specified exception the topic does not exist
  3. If bot is able to send message the topic exist, optionally, you can simply use the deleteMessage method to delete the test message.

Hope this helps!

answered Jul 5, 2024 at 6:22
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.