Handling Inline Queries | Telegram Bot Development | Part 3
Ishan Rayeen

Ishan Rayeen @ishan0445

Location:
Hyderabad, India
Joined:
Apr 19, 2020

Handling Inline Queries | Telegram Bot Development | Part 3

Publish Date: May 11 '20
10 1

Telegram bot development using node.js and Telegraf API.

What you will learn:

  • Inline Query.
  • handling inline query using bot.on().
  • creating a bot that will search the dev.to API and the OMDB API
  • And a lot more.

Requirements:

  • Please watch Part 1 and 2.
  • Basic Programming (everything will be taught from basics).
  • Telegram Account.

Example Bot:
Search for @covid_19_india_bot on telegram or click here
https://t.me/covid_19_india_bot

Comments 1 total

  • Homeyra Mahmoudi
    Homeyra MahmoudiJun 17, 2021

    thanks for your tutorial, i have a question regarding the inline keyboard, I am building a Geodata collector bot and I want to use inline keyboard but I'm not able to use the request_location for acquiring the location of the user because I think it just works on the keyboard not inline keyboard. and since I want to use the callback in my buttons I'm kinda stuck and confused that how I could manage this. if you can help me I appreciate it.

    //buttons for getting the location
    bot.action("POS-PCdF", (ctx) => {
    ctx.deleteMessage();
    console.log(ctx.from);
    bot.telegram.sendMessage(ctx.chat.id, "Can we access your location?", {
    reply_markup: {
    keyboard: [
    [
    {
    text: "Access my location",
    request_location: true,
    callback_data: "Access_my_loc",
    },
    { text: "Cancel", callback_data: "PCdF" },
    ],
    ],
    },
    });
    });

    //the main menu that I want to use in the callback
    bot.action("PCdF", (ctx) => {
    ctx.deleteMessage();
    ctx.telegram.sendMessage(
    ctx.chat.id,
    "Share with us the problems about Parco Campo di Fiori!",
    {
    reply_markup: {
    inline_keyboard: [
    [
    { text: "Pictures", callback_data: "PIC-PCdF" },
    { text: "Location", callback_data: "POS-PCdF" },
    ],
    [
    { text: "write to us", callback_data: "TEXT-PCdF" },
    { text: "Go back Home", callback_data: "go-back" },
    ],
    ],
    },
    }
    );
    });

Add comment