EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

Telegram API key and Chat ID how does it work? #968

Closed x23piracy closed 5 years ago

x23piracy commented 5 years ago

Hi,

i created a new telegram bot and i have the token but i don't get it, how do i gain the chatid and what exact steps needs to be done to make it right, can someone help me please?

Regards X23

asharijuang commented 5 years ago

Chat id you can get from telegram api, from telegram app you can create group with your bot then call this api to get chat id(base on group/single chat)

https://api.telegram.org/bot[token]/getUpdates

expectation for telegram integration is:

Screen Shot 2019-03-10 at 06 17 43
x23piracy commented 5 years ago

Hi,

thanks i found out how it's working.

Regards X23

jmtatsch commented 5 years ago

@x23piracy maybe you could contribute a short howto setup the telegram integration?

x23piracy commented 5 years ago

Hi,

sure:

This started only working for me (Xiaofang 1S, afaik 32MB of RAM (less, less and less)) after i enabled SWAP in run.ssh, i currently only use a 64MB SWAP instead of the default of 256MB.

After that the camera started to send picture by telegram.

@asharijuang you screener from above looks like that you are having currently more functionality than only sending picture through telegram, tell us more please :)

Regards X23

jmtatsch commented 5 years ago

Would you be so kind and make a PR towards the documentation?

x23piracy commented 5 years ago

@jmtatsch do you mean me? Sorry but whats a PR? :)

jmtatsch commented 5 years ago

Yes, PR means a pull request :)

asharijuang commented 5 years ago

in my case motion detect not triger sendphoto to telegram, don't know why.

@x23piracy just modify on /script/telegram-bot-daemon.sh we can play sound, just for fun 😅

Screen Shot 2019-03-11 at 19 52 53
grzegorz189 commented 5 years ago

Zrzut ekranu (3)

I added some functions, I also added reboot this function works when I start restarting the cameras again and again, my question is how to remove / reboot functions from the memory of the camera to perform only once

kszere commented 5 years ago

I update to last git version files project. I put auth api data to file. Change SWAP size from 256 to 64. From url api get id chat. Enable in panel slide motion telegram. In chat i write /start, /mem and not work.

Can you wrote step to step how make this to work?

wiredolphin commented 5 years ago

Just for future reference or for users that couldn't findout the ChatID with the mothods explained before, I was able to get it right with the following instructions:

  1. Search for Botfather user in Telegram
  2. Write /help to him, to see what he can offer
  3. Create a new bot with the /newbot command and provide the requested info
  4. @Botfather will answer with the api key and some other helpful infos
  5. Create a new Group and call it as you want (i.e.: ipcamalarms) and add the created bot user
  6. Now add also the @getidsbo user, he will answer with a chat object containing the userChatId

IMPORTANT: If any, also the minus "-" sign must be included at the userChatId field when setting up the telegram.conf file, for example: userChatId="-436522340"

meidyjordan commented 4 years ago

Hi, I have successfully flashed my Xiaofang S1 (64mb) camera. I have been able to use the telegram feature, but for the /videoalert feature it doesn't seem to work as it should. For features / textalerts and /imagealerts to function properly. Is there something I'm missing? I have also activated Memory Swap.