My first use of telegram bot

I'm trying to send messages from node-red. I installed and configured the telegram according to the instructions here Send messages using Telegram and Node-RED – IoT with us
When executed, it send the message "hello from node-red!" as expected, but i don't know how to change function node to send a message received from inject node.
The original function node content is:

msg.payload = {}
msg.payload.chatId = your-id-here
msg.payload.type = ‘message’
msg.payload.content = ‘hello from node-red!’
return msg;
let message = msg.payload;
msg.payload = {}
msg.payload.chatId = your-id-here
msg.payload.type = ‘message’
msg.payload.content = message
return msg;

assuming your inject is inputting msg.payload and is a string with your message.

unfortunately I can't test because I broke my flow :)) I don't know what I did to them, but I can't work at all, I cleaned up some empty flows and now I have an error when I deploy:
Flows stopped due to missing node types.
telegrambot-config

but nothing is missing from my flow

go to config in sidebar hit unused, delete all unused configs by highlighting them, then pressing delete on keyboard, then redeploy

that was the problem, there was many unused nodes, now telegram send the message I want, thank you very much

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.