I’ve been developing a Telegram bot in Ruby that uses a question and answer pattern, and I’m trying to figure out the best way to capture the user’s reply. In my implementation, I’ve set up a custom reply keyboard that forces a reply from the user. When a chat message is sent with the interactive keyboard options, I need to determine which option the user selected. Below is an example of my current implementation:
HTTPClient.send_request("
BOT_MESSAGE_ENDPOINT", json: {
'chat' => incoming_data['chat']['id'],
'message' => "Do you wish to continue?",
'keyboard' => {
'force_reply' => true,
'layout' => [['Absolutely!'], ['No thanks!']],
'one_time' => true,
'specific' => true
}
})
I would appreciate guidance on how to detect and process the user’s choice efficiently in my Telegram bot workflow, ensuring a smooth and interactive chat experience.