[HowTo] Setting up a Telegram Bot for all your Home Automation messages

Sorry, i didnt catch that. How can i avoid the error message? My log is getting flooded with this annoying message.

Check this topic. As far as i understood right, it was because of using packages other then node-red-contrib-chatbot or mixing them.

Anyone has experience with if node-red-contrib-chatbot or node-red-contrib-telegram-home would be best suited, if Telegram is the only messenger app in use?

I’m using node-red-contrib-chatbot and its really powerful. I have a few automations which trigger telegram messages but i havent figured out yet how to track an answer with the sender node :frowning:

Does this answer your question? :wink:

If your Telegram Out node (Telegram sender) has the option ‘Track’ enabled, and you wire loops back to previous commands, it should work. To exit the tracking is ending with Out node with ‘Track’ disabled (no node output).

Check my example in my first posting and/or check the configuration topic for more explanation.

I got it so far :grinning: I just don’t have any plans to use another messaging service than Telegram, so I am curious if the Telegram only package made most sense or if there were some added benefits with the chatbot package beyond supporting more messaging services.

I really don’t know, I never used the ‘blue-colored-node-telegram’ package.

If I understood right, the node-red-contrib-chatbot (orange-colored) package is better/easier for authorisation of received messages by using the ‘Authorisation’ node.

Hmm - I’m new to node-red so this is probably a me thing.

I’ve got @frenck’s addon (2.0.2) with the system packages for g++ and make running.

When I try and install node-red-contrib-chatbot I have this (rather long) log output.

If anyone has any ideas let me know please!

2019-04-08T20:28:32.034Z Install : node-red-contrib-chatbot 0.16.6

2019-04-08T20:28:32.635Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production [email protected]
2019-04-08T20:28:40.802Z [err] npm
2019-04-08T20:28:40.803Z [err]  WARN deprecated @types/[email protected]: This is a stub types definition. p-cancelable provides its own type definitions, so you do not need this installed.
2019-04-08T20:28:40.818Z [err] npm
2019-04-08T20:28:40.819Z [err]  WARN deprecated @types/[email protected]: This is a stub types definition. p-retry provides its own type definitions, so you do not need this installed.
2019-04-08T20:29:07.745Z [err] npm
2019-04-08T20:29:07.746Z [err]  WARN deprecated [email protected]: use node-fetch instead
2019-04-08T20:29:14.270Z [err] npm
2019-04-08T20:29:14.271Z [err]  
2019-04-08T20:29:14.271Z [err] WARN
2019-04-08T20:29:14.272Z [err]  
2019-04-08T20:29:14.272Z [err] deprecated
2019-04-08T20:29:14.272Z [err]  [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
2019-04-08T20:30:43.364Z [out] 
2019-04-08T20:30:43.364Z [out] > [email protected] install /config/node-red/node_modules/grpc
2019-04-08T20:30:43.364Z [out] > node-pre-gyp install --fallback-to-build --library=static_library
2019-04-08T20:30:43.364Z [out] 
2019-04-08T20:30:45.694Z [err] node-pre-gyp
2019-04-08T20:30:45.698Z [err]  
2019-04-08T20:30:45.698Z [err] WARN
2019-04-08T20:30:45.698Z [err]  Using request for node-pre-gyp https download 
2019-04-08T20:30:46.588Z [err] node-pre-gyp
2019-04-08T20:30:46.588Z [err]  WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.19.0/node-v64-linux-arm-musl.tar.gz 
2019-04-08T20:30:46.588Z [err] node-pre-gyp
2019-04-08T20:30:46.589Z [err]  WARN Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, musl) (falling back to source compile with node-gyp)
2019-04-08T20:30:46.589Z [err]  
2019-04-08T20:30:53.422Z [out] make: Entering directory '/config/node-red/node_modules/grpc/build'
2019-04-08T20:30:53.425Z [out]   CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
[more lines here]
Release/obj.target/grpc/deps/grpc/src/core/lib/debug/trace.o
2019-04-08T20:33:51.487Z [out]   CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.o
2019-04-08T20:33:54.574Z [out]   CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/bin_decoder.o
2019-04-08T20:33:55.651Z [out]   CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/bin_encoder.o
2019-04-08T20:33:56.820Z [out]   CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_plugin.o
2019-04-08T20:33:59.065Z [out]   CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.o
2019-04-08T20:34:01.460Z [err] ../deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc: In function 'grpc_error* try_http_parsing(grpc_chttp2_transport*)':
2019-04-08T20:34:01.460Z [err] ../deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:2466:40: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'grpc_http_response' {aka 'struct grpc_http_response'}; use assignment or value-initialization instead [-Werror=class-memaccess]
2019-04-08T20:34:01.460Z [err]    memset(&response, 0, sizeof(response));
2019-04-08T20:34:01.460Z [err]                                         ^
2019-04-08T20:34:01.460Z [err] In file included from ../deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:44:
2019-04-08T20:34:01.460Z [err] ../deps/grpc/src/core/lib/http/parser.h:71:16: note: 'grpc_http_response' {aka 'struct grpc_http_response'} declared here
2019-04-08T20:34:01.460Z [err]  typedef struct grpc_http_response {
2019-04-08T20:34:01.460Z [err]                 ^~~~~~~~~~~~~~~~~~
2019-04-08T20:34:13.038Z [err] cc1plus: all warnings being treated as errors
2019-04-08T20:34:13.154Z [err] make: *** [grpc.target.mk:481: Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.o] Error 1
2019-04-08T20:34:13.154Z [out] make: Leaving directory '/config/node-red/node_modules/grpc/build'
2019-04-08T20:34:13.169Z [err] gyp
2019-04-08T20:34:13.174Z [err]  
2019-04-08T20:34:13.175Z [err] ERR!
2019-04-08T20:34:13.175Z [err]  build error 
2019-04-08T20:34:13.178Z [err] gyp
2019-04-08T20:34:13.178Z [err]  ERR! stack
2019-04-08T20:34:13.178Z [err]  Error: `make` failed with exit code: 2
2019-04-08T20:34:13.178Z [err] gyp
2019-04-08T20:34:13.178Z [err]  ERR! 
2019-04-08T20:34:13.179Z [err] stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
2019-04-08T20:34:13.179Z [err] gyp
2019-04-08T20:34:13.179Z [err]  ERR! 
2019-04-08T20:34:13.179Z [err] stack     at ChildProcess.emit (events.js:182:13)
2019-04-08T20:34:13.179Z [err] gyp 
2019-04-08T20:34:13.179Z [err] ERR! stack
2019-04-08T20:34:13.180Z [err]      at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
2019-04-08T20:34:13.181Z [err] gyp
2019-04-08T20:34:13.181Z [err]  ERR! System
2019-04-08T20:34:13.181Z [err]  Linux 4.14.98-v7
2019-04-08T20:34:13.182Z [err] gyp
2019-04-08T20:34:13.182Z [err]  ERR! command
2019-04-08T20:34:13.182Z [err]  "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/config/node-red/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-musl/grpc_node.node" "--module_name=grpc_node" "--module_path=/config/node-red/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-musl" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
2019-04-08T20:34:13.183Z [err] gyp
2019-04-08T20:34:13.183Z [err]  ERR!
2019-04-08T20:34:13.183Z [err]  cwd /config/node-red/node_modules/grpc
2019-04-08T20:34:13.183Z [err] gyp
2019-04-08T20:34:13.183Z [err]  ERR!
2019-04-08T20:34:13.183Z [err]  node -v
2019-04-08T20:34:13.184Z [err]  v10.14.2
2019-04-08T20:34:13.184Z [err] gyp 
2019-04-08T20:34:13.184Z [err] ERR! 
2019-04-08T20:34:13.184Z [err] node-gyp -v v3.8.0
2019-04-08T20:34:13.184Z [err] gyp
2019-04-08T20:34:13.185Z [err]  ERR! 
2019-04-08T20:34:13.185Z [err] not ok 
2019-04-08T20:34:13.194Z [err] node-pre-gyp
2019-04-08T20:34:13.194Z [err]  ERR! build error
2019-04-08T20:34:13.194Z [err]  
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/config/node-red/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-musl/grpc_node.node --module_name=grpc_node --module_path=/config/node-red/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-musl --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/config/node-red/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! System Linux 4.14.98-v7
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! 
2019-04-08T20:34:13.202Z [err] command "/usr/bin/node" "/config/node-red/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! cwd /config/node-red/node_modules/grpc
2019-04-08T20:34:13.202Z [err] node-pre-gyp ERR! node -v v10.14.2
2019-04-08T20:34:13.203Z [err] node-pre-gyp ERR!
2019-04-08T20:34:13.203Z [err]  node-pre-gyp -v
2019-04-08T20:34:13.203Z [err]  v0.12.0
2019-04-08T20:34:13.203Z [err] node-pre-gyp 
2019-04-08T20:34:13.203Z [err] ERR!
2019-04-08T20:34:13.203Z [err]  not ok
2019-04-08T20:34:13.203Z [err]  
2019-04-08T20:34:13.207Z [out] Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/config/node-red/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-musl/grpc_node.node --module_name=grpc_node --module_path=/config/node-red/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-musl --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
2019-04-08T20:34:17.309Z [err] npm
2019-04-08T20:34:17.310Z [err]  WARN [email protected] requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
2019-04-08T20:34:17.310Z [err] npm 
2019-04-08T20:34:17.310Z [err] WARN [email protected] requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
2019-04-08T20:34:17.310Z [err] npm
2019-04-08T20:34:17.311Z [err]  WARN
2019-04-08T20:34:17.311Z [err]  [email protected] requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
2019-04-08T20:34:17.311Z [err] npm 
2019-04-08T20:34:17.311Z [err] WARN
2019-04-08T20:34:17.311Z [err]  [email protected] requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
2019-04-08T20:34:17.311Z [err] npm 
2019-04-08T20:34:17.311Z [err] WARN
2019-04-08T20:34:17.311Z [err]  [email protected] requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
2019-04-08T20:34:17.312Z [err] npm WARN
2019-04-08T20:34:17.312Z [err]  [email protected] requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
2019-04-08T20:34:17.312Z [err] npm
2019-04-08T20:34:17.312Z [err]  WARN
2019-04-08T20:34:17.312Z [err]  [email protected] requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.
2019-04-08T20:34:17.313Z [err] 
2019-04-08T20:34:17.380Z [err] npm
2019-04-08T20:34:17.381Z [err]  ERR! code ELIFECYCLE
2019-04-08T20:34:17.382Z [err] npm
2019-04-08T20:34:17.382Z [err]  ERR! 
2019-04-08T20:34:17.382Z [err] errno 1
2019-04-08T20:34:17.384Z [err] npm
2019-04-08T20:34:17.384Z [err]  ERR! [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
2019-04-08T20:34:17.384Z [err] npm ERR!
2019-04-08T20:34:17.385Z [err]  Exit status 1
2019-04-08T20:34:17.385Z [err] npm
2019-04-08T20:34:17.386Z [err]  ERR!
2019-04-08T20:34:17.386Z [err]  
2019-04-08T20:34:17.386Z [err] npm
2019-04-08T20:34:17.386Z [err]  ERR!
2019-04-08T20:34:17.387Z [err]  Failed at the [email protected] install script.
2019-04-08T20:34:17.387Z [err] npm 
2019-04-08T20:34:17.387Z [err] ERR!
2019-04-08T20:34:17.387Z [err]  This is probably not a problem with npm. There is likely additional logging output above.
2019-04-08T20:34:17.675Z [err] 
2019-04-08T20:34:17.676Z [err] npm ERR!
2019-04-08T20:34:17.676Z [err]  A complete log of this run can be found in:
2019-04-08T20:34:17.676Z [err] npm ERR!
2019-04-08T20:34:17.680Z [err]      /root/.npm/_logs/2019-04-08T20_34_17_572Z-debug.log
2019-04-08T20:34:17.747Z rc=1

@phillprice node-red-contrib-chatbot depends on grpc, which is not available/compatible with ARM based systems.

You are trying to install it on a Pi (or similar ARM device). That won’t work. This is not a limitation of the add-on, but a limitation of one of the decencies of node-red-contrib-chatbot.

2 Likes

Thanks @frenck - didn’t think it was a problem with the add on don’t panic. I seem to be able to hook together node-red-contrib-telegrambot in its place :slight_smile:

In that case i’m Interested in your addon config :slight_smile:

Sorry I mean you’re right it’s a raspberry pi. So it’s not an add on problem :slight_smile:

Hey, is someone using chatbot to send videos to telegram?

This is what i have now but its not working

It records my camera, delays the message untill the video is created as mp4 and should send it with telegram. But I always get this error:
"Error: EFATAL: Unsupported Buffer file-type"

It works when i replace the video node with a document node but then i receive a zip file which is quite unhandy. I hope you can help me out :slight_smile:

Having issues with this setup. Can you add more color on how to setup the conversation node? Also you have to add 3 nodes just to send a message?

msg : string[59]

"Inject failed: RangeError: Maximum call stack size exceeded

Keep getting this error.

I can’t seem to get the user id from that url is there anything special I should be doing?

https://api.telegram.org/bot<token>/getUpdates

@jimpower same here, don’t know what the problem could be :thinking:

First of all, you have to send a message to the bot first and then you should have content.
The url https://api.telegram.org/bot<token>/getMe is returning content. :roll_eyes:

Another working option to get the user id is by using a Node-Red Telegram receiver node with a debug node attached to it and check the payloads chatId value.

Why the getUpdates function is not working, beats me…

1 Like

Is that right? Because it is working on every standard install with Raspbian (Node Red is standard preinstalled) where I ever worked with.

Looks to me it is a HassOS related issue. Please correct me if I’m wrong.

Not fully wrong, not correct either.
There are more factors to take into account. HassOS is not one of them, since Hass.io runs everything in containers.

Raspbian is a special kinda thing… So that is not a generic solution in this case.

Another difference, the add-on is based on Alpine Linux (which uses Musl lib instead of GLibc at the core).

@Domoticon there you go, corrected :wink:

1 Like

I get it @frenck. Thanks for the correction :smile: