[SOLVED] [telegram] 404 error

Did you change the tokens with a - in front if the telegram.cfg?

It is like shown in post 1 there is no -

Sorry, the chatIds

put a - in front:

# Read http://www.instructables.com/id/Telegram-Bots-for-beginners/
# to see how to set up bots and find your chat ids
# bots=bot1,bot2
bots=heinz,kathleen
# Handy Heinz S7 Active
heinz.chatId=-XXXXXXX
heinz.token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Handy Kathleen iPhone
kathleen.chatId=-XXXXXXXX
kathleen.token=XXXXXXXXXXXXXXXX

no effect

I don’t know buddy…
Works here… Just tested

is there a log dedicated to telegram with more information?

Have you searched the forum?

Logging for telegram works exactly the same as logging for all of the other actions/bindings.

Try to configure only with one bot and see if that works. You can also test by sending the telegram to your group name ‘bots’.

The dash (-) in front of the chatId is a MUST for group chats. For a regular chat, there is no dash.

You might want to look to the config of the telegram action. Maybe you tested more config’s and the action didn’t save properly the new one.
Take a look here HowTo: Manage OpenHab 2 configurations, section Some useful Karaf console commands.
Try and view the current telegram config in karaf console:

config:list "(service.pid=org.openhab.telegram)"

If the displayed config doesn’t match the one from telegram.cfg you should delete it and let the action re-load the config from file by restarting openHAB.

there is also a new method to “enforce” cfg parameters:
place as the first line of the cfg file the service pid and it will cleanly reload the parameters

pid:org.openhab.telegram

Thanks all,
a lot of approaches which I will test at home after work!

I will report

I did this and there is an additional bot1 entry

   bot1.chatId = 7XXXXXX7
   bot1.token = AXXXXXXXXXXXXXXXXXXXXXXXXXX8
   bots = heinz,kathleen
   heinz.chatId = 7XXXXXXXXX4
   heinz.token = AXXXXXXXXXXXXXXXXXXXXXXXXXX8
   kathleen.chatId = 7XXXXXXXXX7
   kathleen.token = AXXXXXXXXXXXXXXXXXXXXXXXXXX8
   service.pid = org.openhab.telegram

I deleted my telegram.cfg file and restarted the openhab container. Is it expected to rebuild a fresh cfg file? It did not happend …

this worked to update the cfg infomation.

now only one bot is defined but I am still have a
Method failed: HTTP/1.1 404 Not Found
error in the logs.

May I ask for the debug logging where I have to add this, I am really having a hard time to understand the openhab page about logging …

no, the cfg files in $OPENHAB_CONF are created only when you install the binding (and they are empty with some sample data). They are not recreated if you delete them. You need to recreate it.

If on Linux: openhab-cli console, then:

bundle:list -s |grep telegram
log:set DEBUG org.openhab.telegram
(or... not sure)
log:set DEBUG org.openhab.action.telegram

I did the debug thing, both of them. but there is still no more in the openhab.log …

2018-11-05 21:00:30.981 [INFO ] [egram.internal.TelegramActionService] - Bot heinz loaded from config file
2018-11-05 21:01:09.374 [WARN ] [ab.action.telegram.internal.Telegram] - Method failed: HTTP/1.1 404 Not Found

Sorry for coming back but I am a little lost.

I tried now this command in browser and it worked

https://api.telegram.org/bot7"Bot-ID"7:A"Bot-Token"8/sendMessage?chat_id=7User-Chat-ID4&text=testChat

In the cfg file we are just defining the “User-Chat-ID” and the Bot-Token … ?! right?
Where does the Bot-ID come from?

Right now when i was typing this message I had an idea.

The HTTP API Token which I received by creating a new bot is like this:
7777777777:ABGHSAGDJH(/88(sdfsd

Do I have to put the complete thing into this config line?
heinz.token=7777777777:ABGHSAGDJH(/88(sdfsd

or is it only
heinz.token=ABGHSAGDJH(/88(sdfsd

OMG …

That was too easy to be seen …

SORRY now it is working …

1 Like

post the proper & working telegram.cfg now for others to see :slight_smile: (by the way: mask confidential info)
I don’t use this specific action https://www.openhab.org/addons/actions/telegram/

This is now my working telegram.cfg:

bots=heinz,kathleen

# Handy Heinz S7 Active
heinz.chatId=7XXXXXXXXXX4
heinz.token=7YYYYYYYY7:ABBBBBBBBBBBBBBBBBBBBBBBBBBB8

# Handy Kathleen iPhone
kathleen.chatId=7ZZZZZZZZZZZ7
kathleen.token=7YYYYYYYY7:ABBBBBBBBBBBBBBBBBBBBBBBBBBB8