New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add telegram agent #1381
add telegram agent #1381
Conversation
Awesome @tomknig, thanks! Do you have any sense how hard it would be to make it work with httparty + httmultiparty? |
I think the sending messages part wouldn't be too hard. Although I look forward to add support for telegram commands, which could be used to partly remote control huginn. Something like sending huginn messages such as |
So I migrated the code to What do you think? |
It is assumed that events have either a `text`, `photo`, `audio`, `document` or `video` key. You can use the EventFormattingAgent if your event does not provide these keys. | ||
|
||
The value of `text` key is sent as a plain text message. | ||
The value of `photo`, `audio`, `document` and `video` keys should be an url which contents are sent to you according to the type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: maybe "should be a url whose contents will be sent to you".
Awesome @tomknig! |
- minor improvements of the description - use HTTMultiParty directly, instead of including it - ensure that tempfiles are closed and unlinked
Thank you for the valuable feedback, @cantino! I would be happy if you could review the file closing and unlinking. |
Looks great to me, thanks! |
Thanks for your work I love the way Telegram lets you handle bots. It's a really useful intermediate way between instant email and feeds. I think there is an error in the description:
It should be https://api.telegram.org/bot/getUpdates instead (or any other way you think you can state you need to insert there the auth_token. |
Hi @Pcsl, thank you! I think I don't really understand what you mean. |
|
||
1. Obtain an `auth_token` by [creating a new bot](https://telegram.me/botfather). | ||
2. Send a private message to your bot by visiting https://telegram.me/YourHuginnBot | ||
3. Obtain your private `chat_id` from the recently started conversation by visiting https://api.telegram.org/bot<auth_token>/getUpdates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that is why I was confused. The description contains the auth_token, but markdown seems to omit it! Thank you for reporting that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was it. Thank you for your hard work!
I have a problem wit this Agent, maybe I don't understand how to use it right. Is this right? If yes, I don't get messages. If I try it over my browser with this URL get a message, a bit strange. |
Hi @jarlave, i think the problem is probably the incorrect |
Ok, thanks, now it works, don't know what I did wron last time, now I need to find out how to make newline because %0A isn't working with this agent. |
👍 you did try \n I guess?
|
\n works for me. Just take into account that when editing the agent for some reason a new slash is added so that can cause problems. Just make sure you are using \n and not \n |
I tried both, \n (single slash) and \n (double slash) in the event formating agent to send it to the telegram agent, nothing works, What is wrong. |
@jarlave Does using |
Yes, this works, thanks to all! That was a tough nut to crack :D |
Cool! And thanks for the support! :) |
Hi, this agent aims to be an alternative to notifications via slack, sms or email. It makes use of the telegram bot api to post values of events via telegram.
The simple case is sending the value of a
text
field of an event. More interesting is fetching the image behind the url in aphoto
field of an event and send it to you. This enables you e.g. to check for the latest xkcd and receive the image itself via telegram. The same is true for audio, video and document keys accordingly.I decided to add the dependency to
telegram-bot-ruby
since it is a welcome abstraction of the api but more importantly of the multipart uploads that are necessary for the mentioned use of file sendings. As far as I know, the latter could not easily be done withhttparty
, which already is an dependency, but would at least require another dependency such ashttmultiparty
. So that's why I thought it's worth including telegram-bot-ruby.I am happy to get any feedback on my thoughts and the code. Thanks for huginn! :)