Node-Red chat integration: Telegram bot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to a new episode on my home automation open have a node-red series today I want to talk about Chad integration with node-red and in this specific case I want to talk about telegram which is a messaging application I don't know about you but I grew up with you know ms-dos back in the was at night is probably so I'm quite used to you know type commands and you know remember different commands and that's that was the way how I used to interact with with a computer and even today we are using many chat applications like you know what's our facebook Messenger and I wanted to have some sort of you know messenger integration with my node-red because in many cases I it's easier for me to type in commands and then wait for the response or you know just to get notifications via like a chat service that I can reply to naturally I want to do the integration with whatsapp because that was the messaging app that I knew but he wasn't really straightforward and I've actually given up after a couple of tries and I then later on I stumbled upon telegram based on another example and that's just yet another messaging application like whatsapp or messenger or viber it uses the same concept where you have a mobile application that you download to your phone you register it with your phone number and then you can start messaging but then it has one crucial feature which is absolutely useful for node-red or the integration itself is that within telegram you have the general users but you can also create boats and both act like like chat rooms in in like an IRC chat service where users can connect to that boat and getting can send messages to that boat an external application for example node-red can connect to this boat so all the messages that are going to these boat from users are captured by node-red and then node-red can decide how it going to respond to those messages and then send messages back so that's how the whole integration so what I could do is create a boat for my node-red system and then have a fluid node-red which is linked to this specific boat so whenever I send messages from my telegram user to this bot nobody is able to pick this up and able to respond and the response could be quite different as you can see I have some of the responses that text some of the responses I voice responses some of them are images so I can have my IP camera to send an image when somebody rings the door and I can have just you know static messages that for example one of my ESP is not working or transmitting data and in other cases I can have comments like you know turn on the Christmas light and then node-red will say that yes turning on the Christmas light so these are the sorts of applications I was able to do so in this video I'm going to go through my examples that you can use to you know create your own telegram integration in order to keep this video short most probably is going to be quite long anyway I'm not going to go into the you know the every single detail of the code so if you want to implement this for yourself then most probably you have to do a lot of digging in order to understand how this actually works and you know look at the messages going in and out to you know really understand the details and how to adapt it for your own scenario so it's not going to be a very easy you know plug-and-play cord you definitely would need to spend some time and and probably modify some of the you know JavaScript code but it's not that difficult but and that's only just one concept you can implement it in in probably many different ways as well as you can see the the code is or the flow is you know fairly extensive but it has quite a few integrations with some of the other you know node-red code that I have written so for example the IP camera integration or my integration with my system diagnostic framework so I can have my node read to send me informations for example if my one of my ESB is not working and have it sent to my telegram account and with this one I also have a small UI front end which is just mainly about the user management I'm going to talk about that a little bit later to start with I want to show a blog post that I found I mean probably there are quite a few block was hard to create a telegram board but this is one that I used and it explains how you can create your own boat and it's a fairly easy process basically you install your telegram on your phone you you know create your account you link it you bit of to your phone numbers so it's pretty much the same process as you would have seen for whatsapp and viber and you find this boat which is called the boat father and then here the both father has a couple of new commands so you can get these by typing slash help and then one of them is a new boat so you create your type slash new boat and then you go through the process so the boat is going to ask you or the boat father is going to ask you a couple of questions for example what should be the name of your boat what should be the ID which is probably something similar with out you know spaces and and upper cases and then finally once you are done you will get an API key which then you will use later on to to link it with in node-red and you know once you have done the boat is created you can find your boat just like you as you would find a new contact and you can add it to your wall at City or account or you can start a new chat with this board and then once you start chatting with the boat or obviously nothing is going to happen because by standard this boat doesn't really do anything so it's basically just accepts your messages but now you can have no dread to process these messages and then you know respond something to it and as you can already see from here in in telegram you can send messages like you know just simple text but you also have some commands with start with slash and this is how you handle the different kind of inputs that you can receive from telegram but let's go over to the code first and first of all I just want to show that there is the node-red contrib telegram bot so that's the component that you want to install whoo and I'm finally out of date so probably I should update this component or this node and then once you install it then you will receive a few different nodes so first of all they are going to be in the diagram group and you have a receiver a call command a callback a sender and a reply and to be honest I have only used the command and the sender in this code and basically what the command does it it listens to a specific comment so you can have one of these node to listen for for example slash start and the other one to cell listen to slash register and you would only get the output once that message is one once that specific message is sent yeah or sorry sent to the bot and the other one is a sender is whenever you are sending something today to the sender when you place any of these nodes and then you go into configuration so if it's a common one you have to specify the command that it should listen to and in the body configure which both to link to so I'm going to go into the DDS but basically you have to give the the name of the boat what you have defined in the bot father and also the API key what the bot father has given to you and that's all so that's all you need to do you can have as many commands as you want and in the sender side or the reply node the only configuration you do is you do you know link it to the bot and that's pretty much it and of course there is a certain documentation how you what sort of message you need to send in the other thing you have to keep in mind is you create these BOTS and these bots are not restricted to any users so anyone who basically stumbles upon your bought can add it to his chat and can start man send messages so that's why I implemented a whole you know user management concept in my flow so when you send a slash start then this node will fire because this is listening to slash start and as you can see here I've connected this start to debug one so we can see what is coming through and every time you you receive a message it will have a certain structure so that structure would have a payload in in which you have a chat ID and that's going to be a unique ID for your user so every time you are sending a message from your user ID it will have this same chat ID there is also a message ID and there is a type which is a message and then a Content which is e empty now because we have sent a comment but if you are sending a free text that basically that text is going to be in the content and also there is going to be an original message which contains you know pretty much the same content so for example in the original message from ID we can see the same chat ID and also while used we also have a chat ID here and the username and then the date and then the text which in this case was less start so this is how you would receive any text from the telegram messenger and the way you respond to it is you can create your own text that you want to send out and basically you also put it into the message content and that's just you know free text anything and that goes into a response node so the response mode would also have this kind of structure so for example the mandatory field is that you also send a chat ID so that's how the the telegram bot knows that this message e from the body goes to your ID and not to somebody else the message type has to be a message so it's like a text message and then the content is the content that you receive so here I have said that if you if somebody starts type slash start then he will receive and some you know information message that well this is the boat for my home automation system and first you need to register and that's your chat ID you are and then you know what you username and that sort of stuff and if I go into the application itself you can see that that's the message that we have received just ignore this unknown function so the next step that I have implemented is I've implemented register where basically you send in the slash register you don't have to send anymore information because telegram is already knows your you know user ID and chat ID and username and basically what is happening in that case a new user would like to register so internally I created an object where I store all the user IDs that has been registered that is being saved in a file so I'm using file instead of the database so if anyone wishes to use this functionality then probably it's easier to use fast and then a database and well this is not something that will get changed very often because well say use after users registers then well they don't really change so much so this function knows hand handles all the registration which is basically you know saving the user information in the in the user list and saving the user list in in a global and also well then outputting it into a file and then once that user registers then it also appears on the UI in the user list so you can see that at the moment it's me and I also have my missus who is the has the telegram client installed so he or she also registered so she can also send some messages or receive messages from the system and here you have a user management where you can select any of these users change the log level the mute the block and then update this user on TV user and just for reporting purposes I also keep track how many messages I have received from telegram users and how many of these were unauthorized requests so this would be requested are coming from users that haven't registered and so it seems that well you know there are no users in telegram who just you know randomly find bots and send messages but I guess it's better to better to be safe than sorry and for every single user I have a couple of attributes so this is the chat ID and the name that comes from messenger and so that sorry telegram so that doesn't need to be changed or updated and I've implemented an access level control where every function that you execute requires a certain access which for example you know you can ask you can change the lights we you know access level one but if you want to arm the the alarm system you maybe you need access level two or well you can decide how you want to split this the log level and the log a mute log is something which is again specific in my installation I have done this system Diagnostics framework which I have a separate video on so there is a piece of flow in my telegram in my node red which monitors various devices my ESP devices and whenever something happens with them so for example they stopped transmitting or they rebooting then each of them generates a log and this log is also directed to telegram so I can define if I want to see all messages or just the critical messages and the log mute is a functionality where I can just say that I want to stop receiving messages for let's say for the next eight hours or something like that and also users can be blocked so they they remain in the user list but they can't access any of the functions within telegram so I thought these are necessary to you know just keep control who is using the the telegram bolt and who has access to some the functions in in the node-red and the user management is basically done here so that's the piece of the code which generates all the UI element that you have seen here and also it does the all the updates so that's where you can you know store the access level or the log level or the block status and all of them would update the global variables and update the file itself and whenever node-red restarts then it reads the file the same you know user file or telegram to chasten and then restores the user user information so it automatically updates itself whenever node-red reboots the rest of the code which is further down here is really about handling all these telegram messages well I wanted to keep it simple so for example I I want to have specific commands that I type into my telegram very simple ones that would execute a particular function so they don't have to be like you know a complete english sentence just something like if I type me it will give information but you know my specific user well it's my chat ID what is my access level my log level and that sort of stuff if I type Canara then it goes to my IP camera and then it will send a message it will take a picture and then send a message send that picture back into my telegram and that takes a couple of seconds because capturing from the are RTSP stream takes a little bit of a time so if I want to I can look at you know what is happening in front of my house and actually I'm getting the same kind of image whenever somebody rings the doorbell so the the doorbell is again connected to my node read via an an RF pitch I have talked about this before in a separate video and that also triggers the same you know image to be taken from the IP camera so these are the simple stuff like you send a send a command and then you receive like a text or an image information and by the way when I talk about commands what I implemented is instead of typing you know like a slash command for which you have to you know change the keyboard so it's a little bit complicated in in the phone I decided that I just want to you know send simple text and that's why here in the code I'm using the telegram sender node sorry the receiver node instead of the command node so because that's the one which listens to all the texts which are coming in so that is one the other nice feature in telegram is that in some cases for example if I do log levels so I want to change my lock level so I can do this log level and I can send in like you know log level two but if I'm not sending any parameters for this command then what I can do is I can give options to telegram which are displayed something like this so my current log level is two and then now it shows me all the other options that I have and these are shown in in buttons sorry as buttons here so I can just quickly select the ones that I need and then that you know goes back as I said as a second message and it's just a really nice and convenient way to you know to interact with telegram because I don't have to you know type a long sentence I can just type a keyword and then you will get options and I have implemented the same for one specific command which is which is like turn or switch so switch on lights so I can say turn on the Christmas light and I will get a message back saying that turning the Christmas light wow it says one I should say on but what I can also do is if I just only type turn then the system knows that I want to you know switch on some lights so then it gives me an options like okay I want garden lights and and I want to turn it on and off so I want to turn it on so now it says turning the light on so I've also managed to do this conversation where has you start a conversation and then node-red would respond you with a couple of options you select one and then it takes on and then you go into the next let's say parameter which again a set of options so you can go through quickly by you know just clicking on these buttons and if you know how this works then you can implement a really nice solution where you only have to type a little and then you get like options and then just quickly select the buttons and then that's it the the whole thing is done so these are the different things that I've implemented here so now I can go through the code and quickly go through how it works oh and actually one more thing what I have also done is I have one special command which is help so if I do this I get a long list of long message where I have all the different commands so for example you can see the camera and me and the log level that I have just used under turned on the switch but I have a few more others so you can always do help and then everything will just send a piece of text like like a half text you know similar kind of concept where you have in beam ms-dos or well in Linux whenever you have a command and you can type like you know /h or slash question mark and then you have this half screen so it's the same concept here I wanted to implement this because you know I do so many different stuff and I don't often use you know most of them but sometimes I remember oh I have done something like this so let me just type help and I can see the list of entries so as I said all of the text inputs are coming through this receiver node which is again linked to the same boat as well as all the other nodes on this flow and first it does an authorization check so in here simply what I do is I look at the chat ID and I check whether that chat ID exists as a user in in my telegram database or in my telegram user list and also checks if this user is not logged or you know anything else and depending on whether this user is authorized or not so if the first port says or the message comes through the first board if the user has access so then it follows on to the next node and if it doesn't have access then it goes to this response text and then here you can see that I'm setting the payload content to you are not authorized so whenever this happens you will get a message back saying that you are not authorized and I've also updating the stats which are being displayed on the UI depending on where the message comes out here then it updates the authorized request if it comes out on the second and it updates that not authorized request so that's the authorization check and the next thing goes to the language processing and this does a few things and one of the things it does the basic thing is that it looks for these specific commands that are indicating you know a specific function so no matter what I if I type a full sentence which has the word help camera at me user list log level then it just ignores the rest of the sentence or the rest of the you know the text and then you would execute that so in that particular function so you have to select this keyword carefully so it doesn't get used in let's say you know any other sentences so probably me is not a good one but specific ones like you're on YouTube were system info probably fun yeah probably not either either but well so you can just type better or you can type you know what is the better or what's the weather like and then it will execute the same function because it finds the word so these are the sort of that reserved words so first it checks that if it finds any of these words then okay that's the common that I need to execute so it carries on and by the way if oh maybe I will talk about it later and next it so if it's none of these reserved words then it tries to treat this the text that we are receiving as like a proper English command so first of all it tries to remove any of the like the AIDS the like a the what is to lights and that sort of stuff so any of the I don't know like the rubbish words which is what you do say you know in a proper English sentence so and finally it assumes that you are giving a command which is like turn on the Christmas lights so it always starts to return or switch so that's what it checks that in the remaining sentence the first word is turn or switch and then it assumes that the next word is going to be the state so turn on or turn off and then it will be followed by a D like a day which what by this time is already removed so the next word of all or the rest of the words is going to be the device that you want to turn so it's a really simple way of you know parsing this text and understanding what is going on and again now here I'm evaluating two different states so at the moment I'm only listening to or understanding on and off which becomes one and zeros and then the thing which I wanted update is going to be what the rest of the sentence after on or off so that's it and we can see or what we will see this later but and as you can see here in the code I'm going to put all this information into the original message so I'm expanding this message dot original message with some other attributes so for example what is a state what is the thing or the object or what is the commands or the credit the command is switch or any of these fixed commands so this language processing node is my way of node-red understanding what you are trying to say in in telegram the next bit is the help request and that's that's fairly easy because again if you have the help in the in the in the text then it is going to say that okay well actually I don't need to execute any commands but everyone needs to provide its you know help text and the way I do it is I said this original message dot help saying that okay now we are you know we are displaying a half text and now everyone here because as you can see the message comes from here to there and there and then it basically loops through all the different function notes so whenever whenever this function node find that okay now we have the message that original message dot help so it's basically a flag that we need to provide a help message then they add their own help message to the content and this is how I get to the get to the end where I have a long text with you know all the different help comments because as you can see now it's adding the message payload content with its own help message with a slash are slash end so it you know breaks into a new line and that information goes out on the third port which is then being looped through all the different function nodes so this camera will Eddie the help text for the camera functions and then the next one adds its own half function so it loops through all of them and then finally it comes through at the last one and then if it was a half request then it sends out that help request whoops all the way to this response so by the time we have all the help lines here and if it wasn't a help request but it has come out on the first node then we just send a response that that he was an unknown function so no one really picked it up from here so that's an unknown function and if it's not a help request then the help is going to be false which means that this function node needs to execute its function and what I usually do here is I again check access so for every one every every of these functions no function note you can set what is the level which is required obviously the higher the level the more complex or the more you know severe the function is and if the user has access then I am sending the message out on the first board if the user doesn't have access then I'm sending the message out on the second port which goes into this common one which sends out the text you are not authorized and if I send out a message on the third node then it means that this wasn't a camera request so I need to pass them pass the message through to the next node so the next one can you know process it so I mentioned before that whenever you have a half request everyone just adds a piece of text to the content and passes it along and when it's not a help request then everyone checks if you know if this is a message for me and if if it's a message for me then I'm going to execute it and based on the authorization I send the message I pass the message through via either the first port or the second port and if this is not something for me then I just pass it along in the third port so it basically gets cascaded through all the function nodes all the way to the end and then if the if it leaves on the you know the third port of the last one which in my case is the system info then it goes here while it wasn't have requests then it must be an unknown function because nobody picked it up so because the message has fallen out at the end and it is really easy to expand because if I just want a new function I can just copy this one loop this through here delete this one and then oops and then we direct the third port to this node so it is really too easy to expand this the whole logic and as you can see that each of that each of these boxes are you know a separate piece of functions which only listen to their own command and most of them are really really simple so for example this me one it you will always find this section in the function node which is responsible for generating the help request and all the only thing which changes between them is the actual text which gets added other than that you have another set of code which checks to use the access level and based on whether you have the access level or not the message is redirected either through the third port or to the second port so it doesn't actually do the execution it just does the handling of the message and if it comes from the first port then I usually direct it to either a simple change node which sends a response or I usually do a function node which does a more elaborate piece of code so for example in the me I have to get a couple of data from either from the messy the message object itself or me you know maybe from the global variable or you know something as within the the node-red system and by the way as you can see here I have somewhere here I'm not sure whether it's it's here in the authorization check or somewhere else but I've also putting the the access leveled lock level and the block state of the current user into the into the original message dot from so I just have all this information for the following notes to to use it to whatever they want so I would say that most of the functions that you can implement would be something really severely simple like this me function where you just handle the access level here and then in a separate function node you somehow generate the output the message that you want to stand back and of course all of these goes to this respawn node or this reply node and then you have some more complicated ones if I take a little level of the example that would be a more complicated piece of logic here in this function node because not only that we can need to handle what's coming in but we also have to send the response out which is going to be in forms of these buttons that you can select so if I go back to my telegram if I do log level again and now it's connecting and the way I do it is that as you can see I have a sign I'm setting a context so whenever I'm sending these buttons out I'm setting the context to a keyboard so next time when the execution comes back here I know that now I am not just receiving the log level command but now I have receiving a keyboard I'm receiving the response for the keyboard and if we look at what is being sent out now you can see that we have sent out a message so we have sent out a message here which says your current log level is to select the new log level so that's the message which goes out but and that's how you normally a message looks like so you have a message type where you have a type message and you have a content which is the actual text but now I can send out some options as well as you can see that I have these options which have to be in a separate JSON format and these are the ones which are being rendered on the telegram screen as these different buttons so you can see that you know that's a keyboard type message and then you have zero or logs one critical blah blah blah blah and then you know resize keyboard well I don't know the rest of the you guys I've def I found a book post on how to format these keyboard ones and now if I receive one then we can see here that we have a payload oops sorry I just have way too many of these nodes so I just need to find one okay so that's the one so that's the message that we are receiving when we are doing two so basically I've selected the I clicked on the button 2 which has these texts that 2 : error plus system protocol messages and basically that button caps caption is coming back as a text and what happens here is now the system remembers that I send out a keyboard so I'm definitely waiting response from the user which is not going to be a new command where that's going to be something which is related to the previous one so that's how I'm keeping this you know context in the system so even though this comment doesn't contain the word log level now the system knows that well that's the response for the log level so whenever the message comes through here and it says oh okay my context is keyboards so I was sending out the keyboard then he starts processing that message which is basically this 1 2 colon and then the rest of it and the way the reason I send out the options like this so I always know that you know it was like 0 something 1 2 3 4 so those are the actual log levels so here I can just double check that my second character is a colon so that means that yeah that the the user has actually selected a button instead of you know typing something in manually which then I can reject and then basically depending on this number which is coming in front I can set the the user details or certainly user log level to that specific value and then send the response back saying that your log level is this one which we can see here on the screen so that's how it is all working and of course for the turn fun we are turning your lights it gets a little bit more complicated because we are sending two keyboards out so first of all we are asking whether you were you know what is the device that you want to you know change the state of and then after that you also provide the actual state whether it's on and off so here it gets a little bit more complicated because that context get used twice and once you have received all the commands for example in the turn here then well you know it just goes out on the first node and then here you can decide whether your your thing or your device was Christmas the planter or the garden in my specific case and you can put the state into the payload and just send that out into well in my case it's going to be MQTT because all these devices are being controlled by and qdt and as you can see most of my other examples are very very simple so if i if i type better let me actually show that so if I type better then as you can see it triggers this forecast IO and then it converts the the respond Jason into a JavaScript object and then basically in the function node I'm just putting a long text together and parsing in various you know data or adding in various data from this response object and then finally you have a text so yeah nothing really special about that and the same for the YouTube so I can ask you know how many subscribers I have how many views I had and that's the same thing it calls an API and then from the response it basically just creates a text and I have a few other examples of example this solar thing where I can ask what is the sorry what is the stats from my solar data and that's fairly simple and here the responses again fairly simple because in this particular case I have most of these data or stored in the global by another part of the of the flow so I just need to retrieve them and put it into the text and then you know return it you don't really have to do anything as I said for every type of message you have to provide at least the content the chat Heidi and the type but the chat ID and the type is already coming via from the incoming message so or the only thing you need to change in most cases is the content and that's pretty much the entire flow which you know handles all the incoming messages and then sense the sense that responds back and as you can see most of them are simple text responses the only difference is this one where I am putting a the image from the IP camera and that is also fairly simple and here the payload just like before it has to be an object and it has to have a few mandatory attributes for example the chat ID which you can get as the chat ID from the incoming message in this one we up until now we use the type message now in this case the type is photo the content is going to be the file name so that's the path and the file name for the image that you want to send so from the IP camera I save the image into basically just a JPEG which is sitting on my PI and then here I'm providing the full path to that JPEG image and then I can also put a caption so you have a caption for the image and that's how you send an image object so fairly simple the other thing you can also do is you can also send a text message oh by the way you can find all the examples so text message looks like this you have a chat ID you have a fixed ID message type time and so it type is message in the content is a text so if you execute this if you send out I will get this text message in my telegram and it will be coming obviously from the from the boat because we are sending this via the bottom and if you want to send an image then again chat ID type photo the content is let's say slash home slash PI slash grab dot jpg and that's the caption and if you find you want to find a message then fairly similarly you have the chat ID you have the type which is voice and the content is the path for the mp3 file and that's how I'm getting these type of messages here the weather is currently partly cloudy with a temperature of 16 degrees and that's something that I send myself every every day 6 o'clock and they're basically just a voice of like a TTS voice of the current weather and some of the other details like my YouTube statistics and that sort of stuff each are you I I like to listen every time yeah every morning and that is being generated by this piece of code which is getting executed at 6 a.m. every morning and again it it it is just basically about two api calls so it goes to the forecast iowa and it goes to the YouTube channels API and once the details are returned then it just puts some text together like you know what is the wind temperature was I what is the temp with the current state of the weather what is the minimum maximum temperature expected for the day and the rain and wind speed and wind direction and that sort of stuff and it is being generated for the forecast a very forecast and also for the YouTube it is joined together in this case it joined together as a string so basically the to just get concatenated one after the other and yeah that's pretty much it and here I have used this specific node which is called the voice RSS TTS let me find that for you so is this one node red country voice a voice RSS DDS and I'm using this particular node because it's very fairly easy to use you send in a text I think there is I can't remember them maybe there is a limitation how long text you can send in but I'm sending quite a long one in and it's not an issue again you have to go online create an account get an API key and I think there is a limit of ten voices per day but I'm usually doing one so that's I'm well below the limit and it's not as nice as the Google text-to-speech but it's nice so what is no does it calls that API it sends in the text and then it receives a response and and it saves the response in an mp3 file and that basically in the output you will get the file name so all I'm doing is I'm putting in okay my chat ID which are basically hard-coded in here I'm saying that okay I want to voice and then the content is the message of payload so that message that payload is going to say like your slash home slash price slash you know something from a mp3 I think it automatically generates a file name or or maybe you have to provide a file name I can't remember if you debug the the message then the message is going in and out you will see so we are putting them whoops so we are putting this mp3 into the message we are sending it back to telegram and just for good housekeeping after two minutes I delete this file so it's no longer on the PI so again that's a fairly easy piece of code hi you you know instead of generating a simple text generator voice and the last piece is is really about my doorbell integration so whenever I receive an RF link or doorbell trigger that you know somebody presses my doorbell that I'm sending out two messages and that's basically just simple messages which says that you know there is somebody at the front door and the only reason I have to because I have hard-coded my and my mrs. chat ID here and not in here but at the same time the RF link piece of code is also triggering the NVR flow to take an image of the IP camera and once that is done once the image is taken that information comes through here and that's the one which is sending out the images so when the doorbell is pressed I immediately get a text and then after about five seconds once the image is taken I will receive the image as well so I always get two messages and of course everything goes back to the you know this what is it the the telegram sender and it doesn't really matter whether you have one telegram sender or multiple as long as they are connected to the same boat you can have as many as you want and it would function the same way as you if if you if you would only have one and connected all your nodes into that one so that will be my quick look of my telegram integration with node-red as usual you will find all the links in the video description so I will put the link to this blog post I will also put the link to this whole flow so you can download the flow and you can start modifying I'm going to put the entire flow in it and I will try to do my best in order to you know delete all the chat IDs and the API key is that I specific to myself so in most cases you will see some you know placeholders or X's or something like that in in those places you need to provide your own create your own accounts otherwise it's not going to really do anything I hope this video was enough to just show you the con the whole concept how I designed this flow and and hopefully that's modular enough for you to you know to modify it easily I mean at least I tried this part to be really with the modular so it is easy to you know copy these function nodes link the new ones into this basically cascading flow and then create new functions and a new functions to this flow there is still I would say a lot to do on this one in the future I would like to change this language processing part with the echo let note on which I have done a separate video a couple of months ago and I don't really like this part as well so I have the these few examples so this voice statistics and the doorbell one where I have actually hard-coded all the chat IDs into these function nodes which is all fine because basically in my specific case there are only two users so it's easy to remember that chat IDs but in the future it will be nice to implement something a little bit more configurable where you would have I have some ideas where you have these services so for example this morning voice statistics would be a service and the doorbell would be a service and within telegram or within the UI you can subscribe to services so then you would there will be a piece of code here which says ok which are the users who are interested in the doorbell and then send the messages to them based on the user list and not based on you know hard-coded chat ID values I hope you find this video useful thanks for watching and hopefully see you in the next video
Info
Channel: Csongor Varga
Views: 36,343
Rating: undefined out of 5
Keywords: node-red, home automation, programming, javascript, telegram, bot, chat, conversation, messaging
Id: wR1zWroRtCg
Channel Id: undefined
Length: 49min 28sec (2968 seconds)
Published: Thu Sep 27 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.