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

16781012

Comments

  • VeldkornetVeldkornet Member
    edited January 2018
    Okay, I’ve updated the app. 

    I first removed my own bot, then I tried to register the Homey bot, then afterwards my bot... As from the text on the settings page, it gave me the impression that I needed to use the Homey bot if I wanted to use groups...

    Anyway, so now if I send “ping” to the default Homey bot, then my own custom bot replies with “pong”. Is that the expectation?

    Secondly, by doing all of this, I seem to have added myself to the list of users. but, how do I now add other users, and specifically groups?
  • jorden said:
    Fix for custom bot (temporary):

    Open the following URL
    https://api.telegram.org/bot<CUSTOMTOKEN>/setWebhook?url=https://webhooks.athom.com/webhook/5795eeea20ad3acc0b868ced

    Replace <CUSTOMTOKEN> with the token of your custom bot. Should work!
    {"ok":true,"result":true,"description":"Webhook is already set"}

    But I do not see any users/groups under settings.
    I don't know how that would even work? Where are you trying to get the users/groups from?

    Should I be able to send from a flow to @telegramname directly? Or do you need to enumerate users/groups first?

    Normally I would just send a telegram to a group/user by embedding the name in the url. I think that should be possible by using "naam ontvanger" (name recipient) as a variable so you can just fil in in the flow just like the message part?

  • You have to register each user and Group first. Then the telegram app Will show them
  • jorden said:
    You have to register each user and Group first. Then the telegram app Will show them
    And how do you do that?
  • jorden said:
    You have to register each user and Group first. Then the telegram app Will show them
    And how do you do that?
    Send the register command in the chat. Or include the bot in a group and then send the register command
  • VeldkornetVeldkornet Member
    edited January 2018
    jorden said:
    jorden said:
    You have to register each user and Group first. Then the telegram app Will show them
    And how do you do that?
    Send the register command in the chat. Or include the bot in a group and then send the register command
    Works fine for a user, but I’m having trouble with the group. Is there a specific format I need to use?

    I tried:
    /register XXXXXXXX 
    and
    /register@athomhomey_bot XXXXXXXX
  • The telegram app works fine with text.
    As soon as I add an image of a hikvision IP camera, the telegram app crashes (log send to maker)

    http://name:password@ipnumber/ISAPI/Streaming/channels/101/picture

    Everything worked perfectly for the update
  • @satellietje I saw a crash log come in, thanks. Will have a look at it soon.
  • jorden said:
    jorden said:
    You have to register each user and Group first. Then the telegram app Will show them
    And how do you do that?
    Send the register command in the chat. Or include the bot in a group and then send the register command
    Works fine for a user, but I’m having trouble with the group. Is there a specific format I need to use?

    I tried:
    /register XXXXXXXX 
    and
    /register@athomhomey_bot XXXXXXXX
    The first should work, but I'm going to have to doublecheck this functionality. It all worked fine when I tested, although the messages to the group were not sent to the Webhook, except for the /register command. The other way around worked (from Homey to the group)
  • The telegram app works fine with text.
    As soon as I add an image of a hikvision IP camera, the telegram app crashes (log send to maker)

    http://name:password@ipnumber/ISAPI/Streaming/channels/101/picture

    Everything worked perfectly for the update
    Did you use the ImageGrabber? My ImageGrabber does not trigger anything anymore. Or did the image originate from somewhere else?
    I did a "test run" on Homey and it sends my image using Telegram without a problem.

    Please note:
    - The apps now use official Image Tokens. They are incompatible with the old format. You will have to set it up using the new image tokens, or it will not work
    - Not currently compatible with the images that you grab using the Synology app.

  • Yes, I use the image grabber.

    I did not do anything with the tokens just updated both apps.
    Then there will be the problem. Later today I will reinstall both apps and see how I can setup the new tokens.


  • Hmm, ImageGrabber trigger at the office works... why not at home :p Guess it is something odd at my Homey. So that is not the problem currently I guess.
  • Yes, I use the image grabber.

    I did not do anything with the tokens just updated both apps.
    Then there will be the problem. Later today I will reinstall both apps and see how I can setup the new tokens.


    Just remove the card that sends the token to Telegram, and the "ImageGrabber" token, then place them again. That will most probably solve your problem.
  • jordenjorden Member
    edited January 2018
    I found a problem for messages that don't come through if you switch from an existing Homey bot, to a new one, or from the "general" bot to the custom one. This will cause the Homey bot to not register correctly, because the message id on the custom bot possibly is lower than on the default bot.
    I will make "/register XXX" (XXX is your Homey unique device_id) reset the message id counter in the next version.
  • I think version 0.2.3 will solve the problems with the group chat, and custom bot. Will submit it for approval in a few minutes.
  • jorden said:
    I think version 0.2.3 will solve the problems with the group chat, and custom bot. Will submit it for approval in a few minutes.
    Great! Are there any specific this I would need to do? Re-register or something?
  • jorden said:
    I think version 0.2.3 will solve the problems with the group chat, and custom bot. Will submit it for approval in a few minutes.
    Great! Are there any specific this I would need to do? Re-register or something?
    Yeah, if registering did not work please try again after the update to 0.2.3 (not yet approved).

    The problem was caused by the fact that I have Homey "remember" the last message id received, because sometimes Telegram sends the messages twice.
    I used to check if the new message id was higher than the last message id, otherwise discard the message; now I just check if it is different than the last one. So if it doesn't work, just do it two or three times and it should succeed :)
  • New version just got published
  • jorden said:
    New version just got published
    I got mine updated, but I still can’t get the group working. 

    I noticed that that the ID used for register didn’t change, is that correct?
  • jorden said:
    New version just got published
    I got mine updated, but I still can’t get the group working. 

    I noticed that that the ID used for register didn’t change, is that correct?
    The app probably remembered.

    Did you invite the bot into the group?
  • jorden said:
    jorden said:
    New version just got published
    I got mine updated, but I still can’t get the group working. 

    I noticed that that the ID used for register didn’t change, is that correct?
    The app probably remembered.

    Did you invite the bot into the group?
    The bot is in the group yes
  • And if you try /register <CODE> a few times, it still doesn't work?
  • jorden said:
    And if you try /register <CODE> a few times, it still doesn't work?
    Nope, I sent it 3-4 times
  • Damn. Will have to investigate further (but don't have time for that right now)
  • doesnt work for me as well hmm. no respond when i tried the /register command
  • With a custom bot or with the default bot?

    With a group chat or with a normal chat?
  • custom bot with normal chat
  • Did you follow the steps on the "Settings"-page? You have to insert the custombot token before you register.

    Please also doublecheck if the URL for the Telegram webhook is correctly set:
    https://api.telegram.org/bot<CUSTOMTOKEN>/setWebhook?url=https://webhooks.athom.com/webhook/5795eeea20ad3acc0b868ced
    (replace <CUSTOMTOKEN> with the token of your custom bot).
  • i did insert the custombot token.

    {"ok":true,"result":true,"description":"Webhook was set"}
    
    is what i see 
  • khangwei said:
    i did insert the custombot token.

    {"ok":true,"result":true,"description":"Webhook was set"}
    
    is what i see 
    For me, I send actions to the normal bot, and it responded via my custom bot. 

    Although ive since removed my custom bot. 
Sign In or Register to comment.