Closed erizivak closed 2 years ago
Hi there! You need to pass the chat_id
parameter as part of msg.payload
, not in msg.telegram
. So it should probably look something like this:
var chat = global.get('ChatID');
msg.method = "sendMessage";
msg.payload = {
chat_id: chat,
text: "Hello, world!",
};
return msg;
Let me know if that helps solve your issue! Feel free to re-open if it doesn't.
Hi @scraton The correct payload should be:
var chat = global.get('ChatID'); msg.method = "sendMessage"; msg.payload = { text: "Hello, world!", }; msg.telegram ={}; msg.telegram.chat ={}; msg.telegram.chat.id= 7373910; return msg;
With this change, the workflow is working
To solve this 'issue' you need to modify the following files:
utils.js line 19
return (node.chatId || (msg.telegram && msg.telegram.chat && msg.telegram.chat.id)|| msg.payload.chatId);
notify.js line 33
var chatId = node.chatId || msg.telegram.chat.id || msg.payload.chatId;
payload.js line 69
var chatId = node.chatId || msg.telegram.chat.id || msg.payload.chatId;
switch.js line 60
var chatId = node.chatId || msg.telegram.chat.id || msg.payload.chatId;
I hope this helps you
HI, I'm using your telegram's bot to send a telegram message when a new event is received from a topic, for that propose, I use the following code:
var chat = global.get('ChatID') msg.telegram={} msg.telegram.chat={} msg.telegram.chat.id=chat msg.method="sendMessage"; msg.payload = { text:msg.telegram }; return msg;
The payload box is not showing any issue but is not sending the message to the user. Flow: