I tried to set chat permission for the pilot version of my bot using this url:
https://api.telegram.org/bot<token>/setChatPermissions?chat_id=<chat_id>&can_send_messages=0
But I must try it almost 20 times until it really works and the 19 other times, nothing happens.
Wondering I always receive this back even when it does not anything:
{"ok":true,"result":true}
What is the problem? Is it a telegram side problem or it’s from my url?
2
Answers
I think you need to do this as a POST request (or serialize the parameter value in GET request). Analyzing the source code of the random tool, I found another method containing parameters of complex types, and it looked like this:
This, and the syntax described in the documentation, suggests that the
permissions
field must be given:I found the sample code in this repository: telegram-bot-api
It is not correct to send it as you send.
Please send the permissions as json:
https://api.telegram.org/bot/setChatPermissions?chat_id=<chat_id>&permissions={"can_send_messages":true}