php - Telegram bot not sending posts to a group
Get the solution ↓↓↓I have a ticketing systems powered by osTicket open source platform. I found a plugin made for odTicket in Github and it mentioned it can send notification of new tickets to a telegram group or channel. The process is that I need to create a bot and paste the bot url *with token) and Chat Id. Here is the documenting of this plugin:
Clone this repo or download the zip file and place the contents into your
include/plugins
folder. Insert Telegrams Bot URL for your bot (ex.https://api.telegram.org/bot<token>/
) and Chat ID.
I created a bot and connceted to a group. the bot urls is:
https://api.telegram.org/bot<token>
and group Id:
osticketchat
Howeverm I don't get any notification in my telegram when posing a new ticket. When I paste the bot url in browser I get:
{"ok":false,"error_code":404,"description":"Not Found"}
I'm not a developer, so I;m not sure if the url is correct or not (I'm sure about the token). Somewhere I read I can add getMe method at the end of url to check if it's working and when I did I get the following message :
{"ok":true,"result":{"id":1672003338,"is_bot":true,"first_name":"osTicket Notification","username":"rafieeticketbot","can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false}}
The ticketing website is :
https://help.rafiee.net
I would be so grateful if someone can help me know what is wrong to solve it. Thank you.
Answer
Solution:
Ok,
I found the problem.
First, I need to add the bot to the group or channel.
Second, group or channel chat id can be gotten by addinggetUpdates
at the end of url.
And finally, I need an edit in Telegrambot.php line 35 by adding a negative sign (-) before $chatid since chat id of group and channels in telegram is negative.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: closed without sending a request; it was probably just an unused speculative preconnection
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.