Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthorized incoming call from undefined #2

Closed
TotallyInformation opened this issue Mar 19, 2016 · 8 comments
Closed

Unauthorized incoming call from undefined #2

TotallyInformation opened this issue Mar 19, 2016 · 8 comments

Comments

@TotallyInformation
Copy link

I keep getting this. I'm not sure I understand how Telegram works with respect to users.

I'm receiving messages on the receiver node anyway but I'm getting this warning for everything. I get it both on the receiver node and on the command node.

Also, it isn't clear what the difference is in the 2 outputs do on those two nodes?

@windkh
Copy link
Owner

windkh commented Mar 19, 2016

Undefined ist strange in this message, as it should be the username from the incoming call message. You will only get this message when you use the optional fields Users and ChatIds. Have you tried leaving those fields empty, does it work then?

@TotallyInformation
Copy link
Author

Hi, thanks for responding. Yes, I've tried leaving those as the default (empty list), putting in the name of my bot & the chatid, and now taking everything out. I still get the same issue.

There maybe 2 issues here?

Firstly, why the incoming messages are not being recognised as coming from somewhere legitimate (I've used both the iOS app and the web app).

Secondly, why do the nodes need to issue a warn since you've got the split output anyway?

@windkh
Copy link
Owner

windkh commented Mar 19, 2016

Hi, the only thing you need ist the token of the bot. Users and chatid need not to be set for the begining.
Which version do you currently use? There was an error in one of the last versions. Please upgrade to 1.9.0 if not happened so far.

I admit, that raising a warning on unauthorized access is not neccessary when the msg object is send to the second output. I will change this in the next version.

@TotallyInformation
Copy link
Author

OK, cracked it. I had done a changed nodes only deploy at some point and the telegram nodes didn't like that at all and were giving errors. I restarted NR and all seems to be well!! Thanks.

Next issue is an unhandled exception in the Sender node. I was trying to work out what the correct format of a message should be (would be useful to have an example in the docs). I had:

{"content":"wow", "chatId":999, "type":"message", "text":"This is some text"}

I didn't get an error in the NR UI but I didn't get the message either. Checking the console, I got:

Mar 19 21:57:33 pi2 NR-Live2[11949]: Unhandled rejection Error: 403 {"ok":false,"error_code":403,"description":"[Error]: Forbidden: can't write to private chat with deleted user"}
Mar 19 21:57:33 pi2 NR-Live2[11949]: at /home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/src/telegram.js:136:15
Mar 19 21:57:33 pi2 NR-Live2[11949]: at tryCatcher (/home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/util.js:26:23)
Mar 19 21:57:33 pi2 NR-Live2[11949]: at Promise._settlePromiseFromHandler (/home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:507:31)
Mar 19 21:57:33 pi2 NR-Live2[11949]: at Promise._settlePromiseAt (/home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:581:18)
Mar 19 21:57:33 pi2 NR-Live2[11949]: at Promise._settlePromises (/home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/promise.js:697:14)
Mar 19 21:57:33 pi2 NR-Live2[11949]: at Async._drainQueue (/home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:123:16)
Mar 19 21:57:33 pi2 NR-Live2[11949]: at Async._drainQueues (/home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:133:10)
Mar 19 21:57:33 pi2 NR-Live2[11949]: at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/node/nr-live2/node_modules/node-red-contrib-telegrambot/node_modules/node-telegram-bot-api/node_modules/bluebird/js/main/async.js:15:14)
Mar 19 21:57:33 pi2 NR-Live2[11949]: at processImmediate [as _immediateCallback] (timers.js:383:17)
M

Changing the chatId to the ID I was receiving from my other clients allowed me to send.

One final question if I may.

How does the Reply node work? Do you have an example flow? I'm not really sure what it does and what the input should be.

@windkh
Copy link
Owner

windkh commented Mar 19, 2016

I am glad that you made progress.

Did you read the readme of the package? It describes some basic scenarios. Then there is the subfolder exampleflows with some useful examples.

If you directly answer to a message in telegram (right-click on a received message and select reply in the popup menu in desktop version of the telegram client), then the original message id is included in the incoming data. The reply node detects this id and triggers the corresponding output. See the chapter "Implementing a on reply node" in the readme or see the example flow
https://github.com/windkh/node-red-contrib-telegrambot/blob/master/exampleflows/onreplymessage

@windkh
Copy link
Owner

windkh commented Mar 19, 2016

btw the underlying api does not have a "stop-polling"-function. That's why the node sometimes causes errors when you redeploy. Restarting node always eliminates that problem. I included a little workaround in the code, but sometimes it still fails. Sorry I can't do anything about this design flaw.

@TotallyInformation
Copy link
Author

Oops! Entschuldigen sie. Sorry. I was reading the info in the nodes and I'd sidetracked myself from finishing reading the README!

Right, I'm getting there now and I'll stop bothering you.

A really useful set of nodes though so thank you for producing them. I can think of some quite cool things to do. One of the reasons I'm interested in Telegram (apart from the US government people who are using it to try and get round freedom of information laws) is that they have clients for all 3 major mobile platforms. Not so many people support Windows Mobile yet.

@windkh
Copy link
Owner

windkh commented Mar 19, 2016

You are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants