V
V
Vladislav Spassky2020-12-27 10:58:50
Node.js
Vladislav Spassky, 2020-12-27 10:58:50

How to get response from inline_keyboard(callback_data) nodejs?

I wrote a bot with a regular keyboard, everything worked fine, then I thought to update it and make the inline keyboard look prettier, but in the end I don’t understand how to access the callback_data value so that I could do something like this

else if (callback_data === '1'){
 bot.sendMessage(query.message.chat.id , Добро пожаловать)
}

Well, for example, here is the source code
else if (msg.text === '☘Трава☘'
    ){
        bot.sendMessage(chatId, 'Укажите свой город',{
            reply_markup:{
               inline_keyboard: [
                    [
                        {
                          text: 'Днепр',
                            callback_data: '1'
                        }
                    ],
                    [
                        {
                          text: 'Харьков',
                            callback_data: '1'
                        }
                    ],
                        [
                        {
                            text: 'Киев',
                            callback_data: '1'
                        }
                        ],
                   [
                       {
                           text: 'Одесса',
                           callback_data: '1'
                       }
                   ]
                ]

            }
        })
    }


Help me please.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question