This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Add a way to cummunicate with a Telegram Bot

168101112

Comments

  • jorden said:
    I am not so familiar with Telegram myself, only have been using it since I found it to be a nice way to send images from Homey....

    Perhaps you can try to see if it is possible to add Homeybot to a groupchat, and then use the /register command that the Homey app shows. That might work. 
    I have found the way Domoticz has implemented it, and I think this should be easy to duplicate.
    https://www.domoticz.com/wiki/Telegram_Bot

    I think this part is what we need:
    https://www.domoticz.com/wiki/Telegram_Bot#Sending_notifications_to_a_channel_to_inform_multiple_users

    I am not a programmer, so I don't know if this is the way you implemented the Telegram app. But if so, it should be easy to add channels :) If not: is there some way I can help using this bot method to use Telegram?
  • I have started working on de SDK v2 version of this app. So far so good.

    This also is kind of a restart for this app. I never had a good plan on where to go with this app, and kinda made it hard for myself because I wanted to do too much.

    The new version will have some options removed:
    - The /snap command will be removed
    - The "custombot" settings will be removed, only the default bot is available.

    However, the new version will have some improvements:
    - Support for "official" Homey image tokens
    - You can "register" multiple chat users to the same Homey, so when you send a message you can select which user or users need to receive the message

    I think this new version will be done by next weekend. I might however have to wait a few days so I can also make the Synology app work correctly again, with the new official image tokens. I already have a new version of the ImageGrabber ready as well, for which I am also still waiting so I don't break anything.
  • 3 Apps getting updated, great news! Thanks! 

  • Oeee can't wait. So, there is comming a functionality that Telegram bot can send a image to the groupchat?
  • How goes the development of the new apps? Waiting patiently here... :)
  • jordenjorden Member
    edited November 2017
    How goes the development of the new apps? Waiting patiently here... :)
    I will have time again next saturday, hope to finish the new Telegram app. However, I'm planning on releasing the ImageGrabber / Telegram / Email / Synology app all at the same time, because the new ImageTokens are completely changed and incompatible with the old versions.

    Might release them as beta though.

  • The new version will have some options removed:
    - The "custombot" settings will be removed, only the default bot is available.
    Do you mean you will remove the possibility to use your own bot, instead of a bot you control? :o

    If so, as I mentioned before, I definitely will not use the app....

  • The new version will have some options removed:
    - The "custombot" settings will be removed, only the default bot is available.
    Do you mean you will remove the possibility to use your own bot, instead of a bot you control? :o

    If so, as I mentioned before, I definitely will not use the app....
    Same here. Privacy matters to me. That is why I chose Homey over some other platforms.
  • mruitermruiter Member
    edited November 2017
    I dont mind. Privacy is something that also comes with trust .
    If privacy is such a big issue telegram with the fsb backdoor isnt a good option anyways.
    (yes its already in there as the whitehat hackers have confirmed)
  • TallguyTallguy Member
    edited December 2017
    Hi Jorden,

    Not sure wether to post this here in this part of the forum or the one about the ImageGrabber, but...here goes :)

    Installed the Telegram bot yesterday (private version) and tested it. Works fine. Then I installed ImageGrabber and after some fiddling around I found out how to get a snapshot from my Hikvision camera(s). I tested the URL in Chrome and IE and both browsers gave me a snapshot in return, so...that seems to work too.

    Then I build these flows in Homey:




    I use the card with my phone to verify that a flow has correctly gotten to that particular part of the flow. I receive the confirmation on both flows, but...no Telegram  :/

    Is this due to the fact that some things within the Telegram/Imagegrabber apps are not working all the time?

    Any help is appreciated.
  • For the second flow, you are using the wrong telegram card. You should use “Stuur een afbeelding” 
  • @Veldkornet indeed mentioned the correct answer :)

    BTW I have decided to put keep the option to use your own bot in future versions.
  • For the second flow, you are using the wrong telegram card. You should use “Stuur een afbeelding” 
    Thanks! Completely overlooked that  :D It's working now
  • jorden said:
    @Veldkornet indeed mentioned the correct answer :)

    BTW I have decided to put keep the option to use your own bot in future versions.

    Whoot! That's great news. Are you also working on an option to send Telegrams to a group instead of a user? :)
  • Mecallie said:
    jorden said:
    @Veldkornet indeed mentioned the correct answer :)

    BTW I have decided to put keep the option to use your own bot in future versions.

    Whoot! That's great news. Are you also working on an option to send Telegrams to a group instead of a user? :)
    Probably not groups, but multiple receivers is something I really want to include.
  • Wouldn’t it be easier to just allow the person to specify a chat ID? Whether it be a user/group/channel? 

    And then just allow multiple ID’s to be set?

  • jorden said:
    BTW I have decided to put keep the option to use your own bot in future versions.
    Good call @jorden !
    It's highly appreciated!
  • Wouldn’t it be easier to just allow the person to specify a chat ID? Whether it be a user/group/channel? 

    And then just allow multiple ID’s to be set?

    I don't know how channels work, but groups work different from user-to-user chats. I currently have support for user-to-user chats and am too busy to investigate how it works with groups and channels, I am also not using Telegram for anything other than Homey communication so I am not even in a group myself :)
  • VeldkornetVeldkornet Member
    edited December 2017
    Well, I’m no developer.... all I know is that I can do everything via cURL with 1 command, just changing the chat ID for user/group/channel. 

    So so for example, to send an image, I just use the following:
    curl -s -X POST "https://api.telegram.org/bot<token>/sendPhoto" -F chat_id=<chatid> -F photo="@/path/to/your/photo.jpg"
    
    Where <token> is of course the token from your own bot, and then the <chat_id> can be a User ID, Group ID, or Channel ID; and that’s it! If I could pass an image token onto a cURL script in Homey, I would have done that :P 
    
    
    
  • khangweikhangwei Member
    edited December 2017
    hi @jorden, thanks for your hard work in this. truly appreciated. like many homey users here, would be great if we can have group chat to work in this app. just a suggestion! :)

    Looking at your codes, it seems that when setting the chat_id intitially, it is getting from the user sending the /register command instead of where the /register command was sent. 

    chat_id = args.body.message.from.id;

    IIf this could be change to Chat.id that would be perfect! Alternatively, allowing users the option to set which chat_id to send to would work as well.

    Thanks v much again. again, just a suggestion! :)

  • This is my mockup of my idea, assuming that you can make that chat_id a variable which is filled in by the flow:

    So you can add multiple Chat ID's and give them a name/ description in the settings:



    Then if the flows, when you want to send the telegram message, you can choose from a list of chat ID's (although shown as the name / description of course)


  • jordenjorden Member
    edited December 2017
    I was, due to the snow and me working from home, able to work on the Telegram app today. So here's my progress so far:
    + I am now able to recognize multiple 'register' actions from different accounts √
    + Sending messages to multiple users works √
    + Homey can be dragged into group chats, and after registering you can send messages to the group. √

    Still need to do:
    - Set up custom bot
    - Be able to send an Image token
    - Be able to delete users/groups from the settings page
  • jorden said:
    I was, due to the snow and me working from home, able to work on the Telegram app today. So here's my progress so far:
    + I am now able to recognize multiple 'register' actions from different accounts √
    + Sending messages to multiple users works √
    + Homey can be dragged into group chats, and after registering you can send messages to the group. √

    Still need to do:
    - Set up custom bot
    - Be able to send an Image token
    - Be able to delete users/groups from the settings page
    Whoot! If you're ever in the neighborhood of Emmen drop by for coffee with a stroopwafel! (thick syrup waffle, they are amazing ;) )
  • canedjecanedje Member
    edited December 2017
    wow this is what I realy like to have.
    I do have a synology NAS and do have several Foscam cam's.
    And I do have a Homey offcourse
    I like the idea to make a snapshot if somebody is pushing the doorbell and send it to my telegram account somehow.

    Is there somewhere a tutorial showing the steps how to make this magic happening?
  • canedje said:
    wow this is what I realy like to have.
    I do have a synology NAS and do have several Foscam cam's.
    And I do have a Homey offcourse
    I like the idea to make a snapshot if somebody is pushing the doorbell and send it to my telegram account somehow.

    Is there somewhere a tutorial showing the steps how to make this magic happening?
    You need the Image Grabber app as well. 
    See the previous page, I posted screenshots. 
  • canedje said:
    wow this is what I realy like to have.
    I do have a synology NAS and do have several Foscam cam's.
    And I do have a Homey offcourse
    I like the idea to make a snapshot if somebody is pushing the doorbell and send it to my telegram account somehow.

    Is there somewhere a tutorial showing the steps how to make this magic happening?
    You need the Image Grabber app as well. 
    See the previous page, I posted screenshots. 

    Thanks. I do understand how to use the cards. I think that will be the easy step

    But I need some help to install/ to use settings for Image Grabber and how to install Telegram app settings.

    It would be helpful to have a tutorial describing all the needed steps

  • canedje said:
    canedje said:
    wow this is what I realy like to have.
    I do have a synology NAS and do have several Foscam cam's.
    And I do have a Homey offcourse
    I like the idea to make a snapshot if somebody is pushing the doorbell and send it to my telegram account somehow.

    Is there somewhere a tutorial showing the steps how to make this magic happening?
    You need the Image Grabber app as well. 
    See the previous page, I posted screenshots. 

    Thanks. I do understand how to use the cards. I think that will be the easy step

    But I need some help to install/ to use settings for Image Grabber and how to install Telegram app settings.

    It would be helpful to have a tutorial describing all the needed steps

    The Image Grabber just needs an URL to the screenshot function of your camera. It is probably listed on https://www.ispyconnect.com/man.aspx?n=foscam
    The Telegram app needs to be installed, then the app shows you how to register your Telegram account with Homey. It's a matter of sending a '/register' command to the @athomhomey bot on Telegram.
  • canedjecanedje Member
    edited December 2017

    Tanks again. This will be a nice project for the weekend

    EDIT: I tested it. It is working perfect!!

  • Got the custom bot working again in the soon2be released app.

    Next is to add support for the Homey image tokens.

    Now struggling with the webhook (which isn't sending the messages from Telegram to Homey right now). When that is done, I can see if I can get the "/ask insert_question_here" function working again. Once that is done, the app is ready for release.
  • The new app is completed. Once I finish the Email-sender, and Synology SDKv2 apps, I will release this app update together with the Image Grabber app.
Sign In or Register to comment.