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

1678911

Comments

  • is it because i am using an existing custom bot and did not create a brand new custom bot and it has pending updates in it? just thinkiing out loud.. not sure what is wrong...
  • 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. 
    You have to go to the Telegram app settings in Homey and remove the custom bot settings using the button.
  • jorden said:
    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. 
    You have to go to the Telegram app settings in Homey and remove the custom bot settings using the button.
    I did. I only use the normal bot now. That was just my observation with the custom bot. 
  • khangwei said:
    is it because i am using an existing custom bot and did not create a brand new custom bot and it has pending updates in it? just thinkiing out loud.. not sure what is wrong...
    That shouldn't be the problem. I have no clue what is the problem, however... I was able to do everything on a clean install here in the office. Will need some time to do more testing. For now, you should use the default Telegram bot which doesn't seem to have any problems.
  • After a couple of hours testing, I deinstall Telegram bot and Image grabber.

    Instal both apps again, setup the telegram bot with a token as descibed. Sending text works fine but a image camera or sample picture not the telegram app crast (Log to maker)
  • So I have a weird situation...

    basically, I have a flow to grab an image from my IP cam, and a second flow which will send the image to myself and to my wife. 

    However! While I get the correct image every single time... my wife gets EXACTLY the same image every time (you can see from the IP cam time stamp), and the image is an image that was grabbed yesterday when someone rang the doorbell...

    I was all excited to show her that she can now finally also get the images, and then she gets an image from yesterday every time :-P
  • khangweikhangwei Member
    edited January 2018
    I deleted the app, installed it again - did it a few times.

    Tried setting up a new bot.

    I checked getWebHookInfo via telegram and got this:

    {"ok":true,"result":{"url":"https://webhooks.athom.com/webhook/5795eeea20ad3acc0b868ced","has_custom_certificate":false,"pending_update_count":0,"max_connections":40}}
    
    
    
    
    It seems like the custom bot is not registering the /register command
  • jordenjorden Member
    edited January 2018
    After a couple of hours testing, I deinstall Telegram bot and Image grabber.

    Instal both apps again, setup the telegram bot with a token as descibed. Sending text works fine but a image camera or sample picture not the telegram app crast (Log to maker)
    I received a few logs, but nothing useful I am affraid.

    TypeError: Cannot read property 'getBuffer' of undefined
        at FlowCardAction.sendImage.register.registerRunListener [as _runListener] (/app.js:100:11)
    I will have to take a look at this, but it seems that the image is invalid. This is not a bug in the app I think.
  • @jorden it works now. i am so sorry. restarting my homey solved the issue.
  • Could a factory reset of the homey solve the problem?
  • Could a factory reset of the homey solve the problem?
    That's a bit drastic if you ask me... if you open the URL that you supply with the Image Grabber, is it only a (valid) JPG file and nothing else? Not a HTML page that shows the image etc.
  • I gave the Homey a factory reset and started all over again.
    Telegram now works fine :)
  • So I have a weird situation...

    basically, I have a flow to grab an image from my IP cam, and a second flow which will send the image to myself and to my wife. 

    However! While I get the correct image every single time... my wife gets EXACTLY the same image every time (you can see from the IP cam time stamp), and the image is an image that was grabbed yesterday when someone rang the doorbell...

    I was all excited to show her that she can now finally also get the images, and then she gets an image from yesterday every time :-P
    Can anyone else test? 1 flow sends an image (snapshot from ip cam) to two different users. 
    1st user in the flow gets the correct image. 
    2nd user in the flow gets an old image. 
  • VeldkornetVeldkornet Member
    edited January 2018
    So I have a weird situation...

    basically, I have a flow to grab an image from my IP cam, and a second flow which will send the image to myself and to my wife. 

    However! While I get the correct image every single time... my wife gets EXACTLY the same image every time (you can see from the IP cam time stamp), and the image is an image that was grabbed yesterday when someone rang the doorbell...

    I was all excited to show her that she can now finally also get the images, and then she gets an image from yesterday every time :-P
    Can anyone else test? 1 flow sends an image (snapshot from ip cam) to two different users. 
    1st user in the flow gets the correct image. 
    2nd user in the flow gets an old image. 
    I’ve figured it out!

    there are two image tokens. “image” (small i) gives the correct picture, while “Image” (capital i) was giving old images. 

    I updated the second action to use “image” and now the images are always correct. See screenshot attached. 



    I must add though, the whole process seems to be a lot slower that it was before.. or is it just me?

    Usually, when someone rang the doorbell, I got the image almost instantly. Now I get it up to 10 seconds later once there is no one at the door anymore. I have the impression that there is now a bit of a delay between Image Grabber’s “Grab Image” and “When an Image is grabbed” since test messages with Telegram seem to be instant. 
  • I don’t suppose you’ve figured out yet what happened with the group registration?
  • There is an app for that purpose I guess
  • I fixed my Telegram issue with the groups. 
    Or rather, I have a work around. 

    Problem is is that your bot only listens for the /register command, and not the /register@athomhomey_bot (or custom bot name). 

    So if there are multiple bots in the group, the bots don’t know who you are talking to. 

    Hence as the workaround, remove all other bots from the group. Run the register command, then add all other bots back. 

    I assume you can can fix it easy enough with an OR statement. 

    I updated tb github issue accordingly. 

    https://github.com/jordenc/org.telegram.api.bot/issues/7
  • I fixed my Telegram issue with the groups. 
    Or rather, I have a work around. 

    Problem is is that your bot only listens for the /register command, and not the /register@athomhomey_bot (or custom bot name). 

    So if there are multiple bots in the group, the bots don’t know who you are talking to. 

    Hence as the workaround, remove all other bots from the group. Run the register command, then add all other bots back. 

    I assume you can can fix it easy enough with an OR statement. 

    I updated tb github issue accordingly. 

    https://github.com/jordenc/org.telegram.api.bot/issues/7
    Thanks, I never tested with more than 1 bot. I will see what I can do about this.
  • Anybody already figured a way to let  Homey respond with a emoji as well on Telegram? :)
  • VeldkornetVeldkornet Member
    edited February 2018
    I think it’s two fold. I think you need to use the UTF-8 notation as shown here https://apps.timwhitlock.info/emoji/tables/unicode .
    But also, I think a code change is needed since Russian characters etc don’t work at the moment either of you check the Github issue list. 

    See also here: https://stackoverflow.com/questions/31430587/how-to-send-emoji-with-telegram-bot-api#34610263
  • I noticed my telegram Bot isn't working anymore so I came here to look for a solution.
    But if I understand correctly there's a problem with the Bot in general now? 
    Or did I misunderstand? 
  • Mine works fine. It’s been sending me messages all day. 
  • works fine over here to.
  • OK, read back a little in the topic, missed some posts, apparently the Image Grabber app now uses image tokens, so I guess that's what making my Telegram-app crash... :expressionless:
    https://forum.athom.com/discussion/comment/66224/#Comment_66224

    I'll see what I have to change to use the tokens.
  • Fire69 said:
    OK, read back a little in the topic, missed some posts, apparently the Image Grabber app now uses image tokens, so I guess that's what making my Telegram-app crash... :expressionless:
    https://forum.athom.com/discussion/comment/66224/#Comment_66224

    I'll see what I have to change to use the tokens.
    It's probably not the token part. The Telegram app now also uses the same tokens.

    However, the Telegram app has had a complete rewrite for Homey SDK v2. Since then, you have to re-register your Telegram user and/or bot. Otherwise the app will crash when you send a message.

    Follow these steps:
    1. Re-register your Telegram user(s) (multiple users now supported)
    2. Re-setup your flows that use Telegram (because the user list is now required)
    3. Re-setup your flows that use the ImageGrabber (because the tokens have changed)
  • jorden said:
    Fire69 said:
    OK, read back a little in the topic, missed some posts, apparently the Image Grabber app now uses image tokens, so I guess that's what making my Telegram-app crash... :expressionless:
    https://forum.athom.com/discussion/comment/66224/#Comment_66224

    I'll see what I have to change to use the tokens.
    It's probably not the token part. The Telegram app now also uses the same tokens.

    However, the Telegram app has had a complete rewrite for Homey SDK v2. Since then, you have to re-register your Telegram user and/or bot. Otherwise the app will crash when you send a message.

    Follow these steps:
    1. Re-register your Telegram user(s) (multiple users now supported)
    2. Re-setup your flows that use Telegram (because the user list is now required)
    3. Re-setup your flows that use the ImageGrabber (because the tokens have changed)
    I already did that some time ago (I looked into the problem some weeks ago but haven't had the time to continue until now...)
    I just redid my flows now, and although I do get the pictures in Telegram now:
    - it takes a long time before I get them (~1 min)
    - the image grabber cards keep showing the turning circles (never goes away unless I reload the page or switch between flows), even after I received the image

    So this might be a Grabber issue instead of Telegram.

  • VeldkornetVeldkornet Member
    edited March 2018
    Double check which token you are using, I found that I had one beginning with a capital letter, and one with a small letter. Homey needed a reboot before the one went away. 

    Second, I already logged an issue with the speed, but apparently it’s a generic Homey issue. The Image Grabber issue was then closed and I’ve opened a generic Homey one: https://github.com/athombv/homey/issues/2173
  • Double check which token you are using, I found that I had one beginning with a capital letter, and one with a small letter. Homey needed a reboot before the one went away. 

    Second, I already logged an issue with the speed, but apparently it’s a generic Homey issue. The Image Grabber issue was then closed and I’ve opened a generic Homey one: https://github.com/athombv/homey/issues/2173
    I reboot regularly (every experimental release :P ) so I only have 1 token. :)

    I commented on the speed issue to show you're not the only one :)
  • Is it possible that the new SDK / ImageToken format and or Telegram on the new SDK has an issue with size? The snaps coming from my camera are 1080p, because well, why not ;) It always used to work fine.

    My limited test with a small 300x300 image via http appeared to be instant. Now while my camera snaps are also http, they're a bit bigger than 300x300.

    In addition to this, has anyone tried with a png or a gif? Mine never arrived...

Sign In or Register to comment.