Telegram Switch Error unauthorized

Hi, my Telegram Switch gives the following error:

received callback in 2939***** from 'undefined' was unauthorized

Can you help correct it please?

  1. the image did not upload
  2. you need to give a better desctiption of your problem. Make a copy of your flow and get rid of everything but the minimal nodes that wil cause the error. Then show yus that flow.
[{"id":"3ea557b1.e7fec8","type":"tab","label":"Teste","disabled":false,"info":"Pagina de testes."},{"id":"ade16afc.ec8a48","type":"stoptimer","z":"3ea557b1.e7fec8","duration":"20","units":"Second","payloadtype":"num","payloadval":"0","name":"10min","x":270,"y":100,"wires":[["c7d87221.bd2dc"],[]]},{"id":"c7d87221.bd2dc","type":"telegrambot-switch","z":"3ea557b1.e7fec8","name":"","bot":"8b22b70c.466fd8","chatId":"293995835","question":"Pretendes Desligar a Luz?","answers":["Sim","Não"],"outputs":2,"autoAnswerCallback":true,"timeoutValue":"","timeoutUnits":"","x":420,"y":100,"wires":[["fe1316ae.dfcd88"],["832e6b5b.d66768"]]},{"id":"f69a1174.d968b","type":"server-state-changed","z":"3ea557b1.e7fec8","name":"Luz Exteriror ON","server":"3e05aa42.de7f36","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.luz_exterior","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"x":100,"y":100,"wires":[[],["ade16afc.ec8a48"]]},{"id":"fe1316ae.dfcd88","type":"api-call-service","z":"3ea557b1.e7fec8","name":"Luz Exterior OFF","server":"3e05aa42.de7f36","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.luz_exterior","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":610,"y":80,"wires":[["16683a6e.cdb636"]]},{"id":"16683a6e.cdb636","type":"telegrambot-notify","z":"3ea557b1.e7fec8","name":"","bot":"8b22b70c.466fd8","chatId":"293995835","message":"Luz Exterior, Desligada !","parseMode":"","x":820,"y":80,"wires":[]},{"id":"832e6b5b.d66768","type":"telegrambot-notify","z":"3ea557b1.e7fec8","name":"","bot":"8b22b70c.466fd8","chatId":"293995835","message":"Luz Exterior, Continua Ligada !","parseMode":"","x":600,"y":120,"wires":[]},{"id":"8b22b70c.466fd8","type":"telegrambot-config","z":"","botname":"Daisy","usernames":"Pedro","chatIds":"","pollInterval":"300"},{"id":"3e05aa42.de7f36","type":"server","z":"","name":"Home Assistant"}]

What you want is to be notified by Telegram when I forget a light on.

Receive a two-option message to remain on or off.

For this I used a telegram switch. I get the message on my phone.
But when answering it does not perform the functions.

And in Node-RED the following error appears:

received callback in 293***835 from 'undefined' was unauthorized

The switch on node-RED is in the state: "Waiting for reply".

Help me please !

Okay, based on the image of the flow you’re using the home assistant nodes with
I don’t know what that timer node is, but it looks like a contrib delay like node.

The telegrambot-home nodes say that the included switch node sends a message over telegram to the configured user to ask a question, and route the message based on the user response. Have you checked the settings in the switch node to make sure the authentication is set up correctly? Check the token with Botfather to verify it’s correct. And make sure you’ve the right chat id too.
This issue is closed/fixed, but offers another insight. Check that your username is set as authorised to communicate with the bot:

1 Like

Thanks for the comment.

I get the message on the phone.
And I answer the question on the telegram on my phone.
That is, the token and Chat ID are correct.

Deblug after answering on the phone:

received callback in 293***835 from 'undefined' was unauthorized

Yes, but based on the error your account, as in you pressing the button, is read as ‘undefined’. And undefined isn’t authorised in the settings. Either you’re seeing a bug in the node, or something in your configuration is askew.

1 Like

My question is how to add my ID to the authorized list.

Can you help? Please

Can you show the config node for the telegram bot, specifically the field “Users”? Ah found it in your flow. Did you confirm this matches your telegram username exactly?
If yes, file an issue on the node’s github

1 Like

I apologize for my english, google translator.
Is that what you want to check? :

Yes. Is your telegram username “Pedro” (username, not display name)? If yes, file a bug. If no, change it to your username. Usernames in the Users field are considered authorised to interact with the bot.

1 Like

Yes, on Telegram my user is Pedro. See the attached image. How can I register the bug?

No, that’s your display name.

That is the user with username Pedro.

By default you don’t have a username until you set it up in your account settings.

Send a message to @userinfobot on telegram to confirm afterwards.

Which also explains why the node gives undefined as your username: you don’t have one at the moment.

1 Like

I got the name "Pedro", I just left the CHAT ID, it worked!

Thank you for your help !

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