[SOLVED] [Telegram-Binding] Conversation with two Chats not working in sendTelegramAnswer

I had the same problem. My workaround was to send a message to each participant of the group and handle their responses individually. You can do that by passing a ChatId (Long!) as first argument (e.g. myChatId) and modifying the Reply name accordingly (e.g. my_Reply_TrashCan) in the sendTelegramQuery action:


telegramAction.sendTelegramQuery(myChatId,"INFO: Ist der/die/das " + Abfall_next_event_name.state.toString + " bereits rausgestellt?", "my_Reply_TrashCan", "JA", "NEIN")

telegramAction.sendTelegramQuery(herChatId,"INFO: Ist der/die/das " + Abfall_next_event_name.state.toString + " bereits rausgestellt?", "her_Reply_TrashCan", "JA", "NEIN")

Of course that implies checking which participant has sent an answer in the answer handling rule:


rule "CALENDAR_Check_Next_Event_my_Reply"
when
    Item TelegramBotHuman__ReplyId received update my_Reply_TrashCan
then
    if (TelegramBotHuman_Last_Message__Text.state.toString == "JA") {
        Global_Trash_Notification.sendCommand(ON) 
        telegramAction.sendTelegramAnswer(myChatId,TelegramBotHuman__ReplyId.state.toString, "Vielen Dank")
    } else {
        Global_Trash_Notification.sendCommand(OFF) 
        telegramAction.sendTelegramAnswer(myChatId,TelegramBotHuman__ReplyId.state.toString, "Na dann aber schnell!")        
    }
end


rule "CALENDAR_Check_Next_Event_her_Reply"
when
    Item TelegramBotHuman__ReplyId received update her_Reply_TrashCan
then
    if (TelegramBotHuman_Last_Message__Text.state.toString == "JA") {
        Global_Trash_Notification.sendCommand(ON) 
        telegramAction.sendTelegramAnswer(herChatId,TelegramBotHuman__ReplyId.state.toString, "Vielen Dank")
    } else {
        Global_Trash_Notification.sendCommand(OFF) 
        telegramAction.sendTelegramAnswer(herChatId,TelegramBotHuman__ReplyId.state.toString, "Na dann aber schnell!")        
    }
end

To my understanding the first participant answering a group query consumes the queryId, so that an ulterior answer cannot be associated with the original query any longer.

1 Like