Send Telegram answer always ends in an error

Hey guys,

I’m trying to use the Telegram binding for notifications.
I have created a simple test rule (okay, two rules :wink: ):

var rulename = "test.rules"
val telegramAction = getActions("telegram","telegram:telegramBot:b0c9xxxxx6")
rule "Test 1"
when
    Item Test_Switch changed
then
     telegramAction.sendTelegramQuery(123456L, "<b>Achtung!</b>\nTest!", "test123", "Button")
     
     logInfo(rulename, "Nachricht gesendet.")
end

rule "Test 2"
when
    Item TelegramReplyId received update 
then
    logInfo(rulename, "Antwort eingegangen: "+ TelegramReplyId.state.toString)
    logInfo(rulename, "Antwort eingegangen: "+ TelegramMessage.state.toString)
    
    telegramAction.sendTelegramAnswer(TelegramReplyId.state.toString, "Ok!")

    logInfo(rulename, "Antwort gesendet.")
end

If I change the state of the Item Test_Switch, the message was sent successfully. If I answer on the message I will always get the following error, but the answer is sent.

2021-03-10 19:49:00.215 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Test_Switch' received command ON
2021-03-10 19:49:00.216 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Test_Switch' changed from OFF to ON
==> /var/log/openhab/openhab.log <==
2021-03-10 19:49:00.273 [INFO ] [openhab.core.model.script.test.rules] - Nachricht gesendet.
2021-03-10 19:49:10.284 [INFO ] [openhab.core.model.script.test.rules] - Antwort eingegangen: test123
2021-03-10 19:49:10.284 [INFO ] [openhab.core.model.script.test.rules] - Antwort eingegangen: Button
2021-03-10 19:49:10.543 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'test-2' failed: null in test

Thank you for your help :slight_smile:

Oh my god - It tried it a lot of hours :face_with_hand_over_mouth:

I found the problem. In my answer query, I do not use the chat id :scream: - after adding the chat id to the answer query it is working :sweat_smile:

1 Like