Can the tgslurmbot be generalized to send messages to other users/groups? #33
Replies: 3 comments 4 replies
-
Hi, Sorry for the hasty post. I actually figured out how to do it with http requests: import requests
TOKEN = "YOUR TELEGRAM BOT TOKEN"
chat_id = "YOUR CHAT ID"
message = "hello from your telegram bot"
url = f"[https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={chat_id}&text={message](https://api.telegram.org/bot%7BTOKEN%7D/sendMessage?chat_id={chat_id}&text={message)}"
print(requests.get(url).json()) # this sends the message |
Beta Was this translation helpful? Give feedback.
-
Hey, Try it out and let me know if that is what you needed? (we tested this functionality long time ago and it worked., i hope it still works, unless telegram api changed in the meantime, then we'll update the code) |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, i can not reproduce this, i've just now created this minimal config and the bot sends the message to the group chat as expected: goslmailer.conf:
goslmailer.log:
Did you add the bot to the group? He must be a part of the group to be able to send there. (afair) EDIT: also, i've tested out the telegramTemplate.html from the release zip and that also seems to work as expected. Will close the #31 then. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm running goslmailer with tgslurmbot configged. As of now, the bot seems to only be able to communicate to its own chatid. I have a telegram group for my cluster where downtime/uptime announcements are made by another bot (basically an ugly python hack that I cooked up here). I'd like to have tgslurmbot do it, but I don't know the go language well enough to figure out how.
Beta Was this translation helpful? Give feedback.
All reactions