Tuesday, 14 March 2017

Add clickable buttons to telegram-bot

I'm developing a simple telegram bot with node.js telegram-bot. https://github.com/yagop/node-telegram-bot-api For now I want user to stop typing messages(with letters), just pressing one of a few buttons. And when he clicks on the button, his telegram's client has to send back to my bot another message(somethink like "clicked yes" or "clicked no"). I've found that it can be made with

var options = {
      reply_markup: JSON.stringify({
        inline_keyboard: [
          [{ text: 'Some button text 1', callback_data: '1' }],
          [{ text: 'Some button text 2', callback_data: '2' }],
          [{ text: 'Some button text 3', callback_data: '3' }]
        ]
      })
    };
bot.sendMessage(msg.chat.id, "answer.", option);

So user reseives 3 kind of messages, and when he clicks them, he doesnt send me back anythink. I need another type of buttons(which will be in the bottom of client's app).



via Kamiky

No comments:

Post a Comment