Node-Red chat integration: Telegram bot

Поделиться
HTML-код
  • Опубликовано: 27 авг 2024
  • This is a quite long and extensive flow I built for telegram integration. It does a few things just to mention a few:
    - Registration of telegram users in the bot (to control who can use the services offered by the bot)
    - Receiving and responding to commands as simple words (not /command)
    - Handling complex conversation where the bot responds with options as keyboard
    - Handling user control where users can only access commands based on their access level
    - Sending text, image and voice messages
    - Complete framework open for adding new functions
    Download the entire flow seen in this video: drive.google.c...

Комментарии • 87

  • @daviddempster8979
    @daviddempster8979 3 года назад +4

    A great video that has given me loads of ideas to expand my current system and use of Telegram.
    Thanks for taking the time to create yet another brilliant video.

  • @jasonguest3447
    @jasonguest3447 5 лет назад +3

    Thank you for taking the time to discuss your flow and to allow us to import the flows!

  • @r5bc
    @r5bc 6 лет назад +1

    I personally always wait for your Node-red videos, they are always so helpful. Many thanks and please keep up the good work! Cheers

    • @csongorvarga
      @csongorvarga  6 лет назад

      Thanks a lot. It has been some time since I made anything new in Node Red, but hopefully there will be more interesting project in the future.

  • @orimate
    @orimate 4 года назад +1

    Hálás köszönet a megosztott flow ért és az önzetlen segítségért!

  • @jazz0104
    @jazz0104 4 года назад +1

    It is great work and it inspires me to make node red more richer than ever. And detail explanation and sharing flow is awesome. Great thanks to you.

  • @josephstivencardonavega9029
    @josephstivencardonavega9029 6 лет назад +1

    excellent video, whenever you upload something related to node-red is very interesting. additionally, thank you for sharing the node-red code to be able to put it into practice and implement great things like this.

    • @csongorvarga
      @csongorvarga  6 лет назад

      Thanks, I hope you can use it for great things.

  • @stevelenehan7695
    @stevelenehan7695 6 лет назад +1

    As always great video - very stimulating and I especially liked the idea of cascading the help message build to make it easily extensible

    • @csongorvarga
      @csongorvarga  6 лет назад

      Thanks, I have seen this help idea somewhere and I wanted to incorporate it. To be honest, I probably only use half of the functions that I developed, so it is good to remind myself what is available.

  • @squalazzo
    @squalazzo 6 лет назад +1

    excellent value as always in your videos, thanks Csongor :)
    lots, lots of info, best practices and ideas we can reuse :)

  • @danishow77
    @danishow77 5 лет назад +1

    Thank your for your effort to make this video. Really impressive.

  • @helikrysly
    @helikrysly 5 лет назад +2

    This is so impressive and ingeniously implemented. I will try to implement this great process with me too. Many thanks for the great video and the Node Red Flow template.

  • @cpginfo4375
    @cpginfo4375 5 лет назад +1

    @Csongor Varga Thanks for sharing this knowledge.

  • @AlejandroMusso
    @AlejandroMusso 3 года назад +1

    Thanks for sharing!!!

  • @kishorekumarreddyramireddy8373
    @kishorekumarreddyramireddy8373 4 года назад +1

    Hi
    Csongor Varga,
    can you provide me the example of setting telegram webhook in node red

  • @tomasmerca3127
    @tomasmerca3127 5 лет назад

    Thanks, this flow is really useful

  • @-xeL
    @-xeL 4 года назад +1

    great work, thank you!

  • @iamnes4744
    @iamnes4744 Год назад

    Is there a way to send MORE images (for example from camera) IN ONE telegram MESSAGE? Example notification: "motion on yard detected cam1.jpg cam2.jpg cam3.jpg". I would be grateful if someone sharing flow for this in nodered.

  • @saurabhgup1983
    @saurabhgup1983 5 лет назад +1

    hi. thanks for your video.
    i have a query. To which folder shall i save my camera snapshot , so that i can provide the path in the content section in function node going towards the send notification node. i am able to send images through "http:.... " pointing to some image on internet... but am confused how to include the path in the content section for a file saved in my camera snapshot folder

  • @peterhunt5961
    @peterhunt5961 4 года назад +1

    Hello mate, very interesting video! :) One question, at 18:30 your BOT shows some buttons. How to define these buttons?

    • @csongorvarga
      @csongorvarga  4 года назад

      You can check my code, but these keyboards which are called inline buttons are explained quite well on the node page: flows.nodered.org/node/node-red-contrib-telegrambot. I have to say that is my most favorite feature of Telegram.

  • @valbuz
    @valbuz 3 года назад

    Hi
    I wrote also a flow, send a picture from my cam when someone is ringing at the door. works correct. But when i deploy a new change or else in NR, the ChatID is empty. so when now someone is at the door, no notification can send... do you know this problem?
    Thanks
    pat

    • @csongorvarga
      @csongorvarga  3 года назад +1

      For all outgoing messages (which is not a response) you have to add the ChatID manually. You should set it on the msg object yourself.

  • @al3xchannel76
    @al3xchannel76 2 года назад

    Hi @Csongor Varga,
    great video and thanks for making your flow downloadable.
    On the BOT registration, if the user at the time of registration shares his contact (with a custom keyboard) it is also possible to store his mobile number and authenticate it considering the real mobile number.

    • @csongorvarga
      @csongorvarga  2 года назад

      I am not sure. I think Telegram has some services to get the user details like real name and phone number, but I did not look into that.

    • @al3xchannel76
      @al3xchannel76 2 года назад

      @@csongorvarga
      From what I remember telegram does not share the user's real details unless he does it.
      To do this the user must share his contact through "request_contact" and the bot must verify that "msg.contact.user_id" is equal to "msg.chat.id" to be sure that the shared contact is his own and not one of the many in the column.
      To use "request_contact" you can create the custom keyboard.
      I'd like to add it to your flow, but I don't know where to add it 😅

  • @ProcrastoMatt
    @ProcrastoMatt 5 лет назад

    What Pallets are you using as i have a few undefined. ui_dropdown, voiceRSStts and sqlite.
    Thanks

    • @csongorvarga
      @csongorvarga  5 лет назад

      ui_dropdown is part of the dashboard, other you will find if you search for these names, voiceRSStts, sqlite.

  • @HeinzSeinz
    @HeinzSeinz 5 лет назад +1

    Nice

  • @fabriziovg7170
    @fabriziovg7170 3 года назад

    Hi good video, I have a question; how I can put the temperature into my bot in node red?

  • @squalazzo
    @squalazzo 5 лет назад

    hi Csongor, trying this flow in my nodered right now... can't understand how to setup the camera part, can't see anything in flow about connecting to rtsp stream url... and it's like some of the LINK nodes are not actually connected to anything...

    • @csongorvarga
      @csongorvarga  5 лет назад

      Yes, that is a completely different flow that I covered in another video.

    • @squalazzo
      @squalazzo 5 лет назад

      @@csongorvarga seen that now, thanks, i'll that too :)

    • @csongorvarga
      @csongorvarga  5 лет назад +1

      Yes, I covered the the NVR part is a separate video and also a completely separate flow. This is why you only see links here.

    • @squalazzo
      @squalazzo 5 лет назад

      @@csongorvarga thanks ;)

  • @ParthBhat
    @ParthBhat 5 лет назад

    Hi,
    I'm glad I found your video while I was scrolling through your other videos as I got the notification!
    Well, idk if you have faced this issue or not, but I have been using my nodered with telegram for 6 to 9months now, but it won't work properly after a while. It won't respond to my messages and won't even give timed replies.
    I have to go to nodered and restart the whole nodered or just hit the update button .
    Never found out what exactly is the issue. But would like to ask you, if you have also faced the similar issue !
    Cheers !

    • @csongorvarga
      @csongorvarga  5 лет назад

      Uh, that is thought. Mine is probably running for the same time, but never had an issue so far. I don't have any recommendations other than keeping NR and the telegram node up-to-date.

    • @stagetelephone
      @stagetelephone 5 лет назад

      Parth, did you find a solution to this? I have the same problem every time I temporarily loose my internet connection. The Telegram nodes just hang until you restart the flows manually. Very frustrating, making an otherwise excellent solution unreliable. It is still exactly the same in the latest version of node red (V 0.20.7) and node-red-contrib-telegrambot (V 5.5.1). Does anyone have a fix ?

    • @stagetelephone
      @stagetelephone 5 лет назад

      I forgot to say EXCELLENT Node Red videos. They are the best node red learning tools in existence. Keep up the good work :-)

  • @gregorypiter4150
    @gregorypiter4150 5 лет назад

    Thanks great video
    what camera you recommend to rstp -nvr

    • @csongorvarga
      @csongorvarga  5 лет назад

      I can't recommend any to be honest. Most of Chinese cameras support RSTP. I have an old Cotier wired 720p camera. I has been working without any issues for years, but broke a few weeks ago, when I was moving my cables around. The camera is probably still OK, I just need to crimp the LAN cable. Most probably connection issue.

  • @silva1tube
    @silva1tube 3 года назад

    Excuse me, how to install dashboard for management telegram clients? Thank you.

    • @csongorvarga
      @csongorvarga  3 года назад

      Sorry, what do you mean? Where did you get stuck?

    • @silva1tube
      @silva1tube 3 года назад

      @@csongorvarga My apologies for my bad english, i'm new on Duolingo App : ) At 13 minutes on the video is shown a management interface for Telegram clients. How is this installed?

    • @csongorvarga
      @csongorvarga  3 года назад +1

      @@silva1tube It is part of the Node-Red flow. You find the link to the flow in the video description. You need to import that into your Node-Red instance. Of course that means that the components (e.g. Dashboard) are installed.

    • @silva1tube
      @silva1tube 3 года назад +1

      @@csongorvargathank you very much for your help!

  • @isidrocampos7981
    @isidrocampos7981 4 года назад

    too hard to start y just copy the code and way too many errors

  • @sdmilliken
    @sdmilliken 3 года назад

    Great video. I can't seem to keep the boot connected. The error is a "polling" error. If I re-deply the flow, then if connects. I'm not sure when it drops as I'm not home all day to watch it. Any ideas?

    • @csongorvarga
      @csongorvarga  3 года назад

      I had the same issue in the past, but somehow it got resolved and I don't remember the solution. Check this thread, may help: github.com/windkh/node-red-contrib-telegrambot/issues/97

  • @kishorekumarreddyramireddy8373
    @kishorekumarreddyramireddy8373 4 года назад

    Hi
    Csongor Varga,
    How to send timeout response when user is not replied anything and can you send me one example for telegram

    • @csongorvarga
      @csongorvarga  4 года назад

      There is a watchdog node you can configure to send a second message after the last message.

  • @OSOOLUWAFEMInew
    @OSOOLUWAFEMInew 5 лет назад

    thanks for the tutorial. I'm trying to add text-to-speech and speech-to-text service to the Telegram on Node, how do I go about that?

    • @csongorvarga
      @csongorvarga  5 лет назад

      I think you should use your mobile device to deal with speech-to-text. I have an android phone and I have a mic icon on the keyboard, so I can speak which gets converted to text on the phone. For text-to-speech I have an example in the code. I am using a VoiceRSS node (node-red-contrib-voicerss-tts) which converts any text in msg.payload to an mp3 file. You can pass the mp3 to Telegram as a voice message.

  • @JonnyBravo631
    @JonnyBravo631 5 лет назад

    Hi @Csongor Thank you very much for your video, it helped a lot, to understand the bot function. Can you please shar how you generate a screenshot from your rstp stream?

    • @csongorvarga
      @csongorvarga  5 лет назад +1

      I have a separate video on that. But in short, I am using avconv in a simple Exec command. avconv is a fork of ffmpeg. And it basically captures a single frame from the rstp stream and saves it on a file on the PI. Very simple.

    • @JonnyBravo631
      @JonnyBravo631 5 лет назад

      @@csongorvarga thank you for your quick reply, I will check your video first :) thank you for your great videos!

  • @victoroltra7203
    @victoroltra7203 3 года назад

    Hi I'm new in node-red and i have a doubt. How can I indicate to the telegram node that the chatId to read are from file of registrations?

    • @csongorvarga
      @csongorvarga  3 года назад +2

      You need to write some code in a function node for that. You read the file when node-red starts to e.g. a flow variable, and than when the message comes is you check if the chatid is in the list or not. I am doing the same checking the chatid against a userlist.

    • @Grafichedelmare
      @Grafichedelmare 3 года назад

      @@csongorvarga Thanks for the video, really useful. I created the telegram.json file but is blank. This is the error message: "Unexpected end of JSON input". Could you kindly help me I don't know how to write the function. Thanks and good job

    • @csongorvarga
      @csongorvarga  3 года назад

      @@Grafichedelmare type /start to your Telegram bot on your phone. That will create the first user and will also overwrite the telegram.json.

  • @aihysp
    @aihysp 5 лет назад

    Hi @Csongor Varga
    , do you have a new version for this?
    i want to implement this... maybe you have some updates ? :)

    • @csongorvarga
      @csongorvarga  5 лет назад

      I started working on some message subscription part of the flow, but it is not complete yet. But that adds to the existing flow, there is no major change the this version.

    • @aihysp
      @aihysp 5 лет назад

      @@csongorvarga Thanks i was able to implement the user system... but i am getting some undefined value ... is there any way we can chat ... not here?

    • @csongorvarga
      @csongorvarga  5 лет назад +1

      @@aihysp Sure, you can email me on my gmail, first name dot last name at....

    • @aihysp
      @aihysp 5 лет назад

      @@csongorvarga thanks i will rap all my Q and send thanks!

  • @lucacialdella3121
    @lucacialdella3121 4 года назад

    Thank you very much to have shared this one. This seems on of the best flow and I personally I'm interested a lot in the part to send camera picture to telegram. Unfortunately I'm not an expert with node red and I cannot understand exaclty the flow to do that. I'm able to get the picture on mt tmp folder and I prepared the payload as in your flow with
    "msg.payload = {
    chatId : msg.telegram.chat.id,
    type : "photo",
    content : msg.filename,
    caption:"Picture from the camera"
    };
    Seems in debug the message is preparedcorrectly, by the way the image isnot sent to telegram. Idon't see any error, so I'm really not sure if the image is sent or not, but in any case it is not received.
    Can you give some more details on this specific part ?

    • @csongorvarga
      @csongorvarga  4 года назад

      I tested the image send again and it is still working. You code is correct. Two things can go wrong, the chat id is not your chat id or the filename is not correct. Did you check what is the payload that goes out to Telegram?

  • @ngoranbedes6811
    @ngoranbedes6811 4 года назад

    thank you very much this is amazing. i tried doing something like this, it worked majority of ooo but at some points i could not get the flow to do what i want. like getting an image from the camera, and controlling relays. pls if you can help me out i will be very grateful

  • @kishorekumarreddyramireddy8373
    @kishorekumarreddyramireddy8373 4 года назад

    Hi Csongor How can we use same bot token and same username for multiple flows

    • @csongorvarga
      @csongorvarga  4 года назад

      You add the bot token to the token configuration and you can reuse that as many nodes as you want.

    • @kishorekumarreddyramireddy8373
      @kishorekumarreddyramireddy8373 4 года назад

      I am getting this error if i add bot token in token configuration "ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"

    • @csongorvarga
      @csongorvarga  4 года назад

      @@kishorekumarreddyramireddy8373 I am not sure what to say. I do the same thing. I have multiple telegram nodes around my flows, I set up the configuration ones, and I select the same configuration on all the other nodes.

  • @mariopalma3802
    @mariopalma3802 4 года назад

    Hi songor, I found your vide very intresting and full of idea to work on. But I'm newbe on NR and I'm unable to run your after localizing. First of all I sent a telegrram msg to be registered, but I alway am unathorized and I don't know how to move forward. I also tried to run the UI but the system is asking me user and pass. can you gime suggestion to fix it? thanks.

    • @csongorvarga
      @csongorvarga  4 года назад

      Uh, so you have created your own bot, right? If so, you need to type /register that will create you as a telegram user in the flow. Than you go to the UI and edit that user, give it access level and enabled it. If you have set user and pass on the UI, it must be the same user and password than the editor. But that was not done by my flow.

    • @mariopalma3802
      @mariopalma3802 4 года назад

      @@csongorvarga I made a mistake... It's all about reading the docs. I cheched the Node-Red configuration and during the installation I defined a USER&PASS I forgot. Now I can acces to the UI but your flow is complex and I have to spend time to personalize.

  • @bwims
    @bwims 4 года назад

    Sadly Telegrambot is useless. The polling fails with an error.

    • @csongorvarga
      @csongorvarga  4 года назад

      My flow is showing polling error, but still everything works fine. Messages are going back and forth without any issues. You can read about the problem here: github.com/windkh/node-red-contrib-telegrambot/issues/97

  • @raymondsiew1696
    @raymondsiew1696 7 месяцев назад +1

    Hi, thanks for the video! Would you be able to advise if there a fix to Telegram unable to send local photo from content:"/config/www/tmp/camera.jpg"? Thanks

    • @csongorvarga
      @csongorvarga  7 месяцев назад

      Interesting... is there any specific error message? And the obvious questions: does the file exists in this folder? Also I am thinking if for any reason Telegram has no access to this file? Can you check if the user node-red is running on has access? Check and see if you can send a photo from the node-red folder, if that is working, it is likely an access issue.

    • @raymondsiew1696
      @raymondsiew1696 7 месяцев назад

      @@csongorvarga it has always been working followed your video but recently it won't send photo anymore. Error is Caught exception in sender node:
      Error: ETELEGRAM: 400 Bad Request: invalid file HTTP URL specified: URL host is empty
      when processing message:
      {"_msgid":"071793268caf49f1","payload":{"chatId":"1234567","type":"photo","content":"/config/www/tmp/g4doorbellpro.jpg","caption":"This is the image caption","options":{"caption":"This is the image caption","chat_id":"1234567","photo":"/config/www/tmp/g4doorbellpro.jpg"}},"topic":""} If I replace local path to a valid ipaddress/image.jpg it works just fine. Thanks.

    • @raymondsiew1696
      @raymondsiew1696 7 месяцев назад +1

      Hey@@csongorvarga you are so right, by changing the video capture destination to media folder fixed the error for now. Thanks.