DEV Community

Cover image for Part 3: I'm building a telegram bot to remind me changing my car oil
Ahmed Nagi
Ahmed Nagi

Posted on

Part 3: I'm building a telegram bot to remind me changing my car oil

Welcome to the part 3 of my journey to create a telegram bot that will remind me changing my car oil.

Checkout part 1 and part 2 for context.

Demo Preview

I got the bot to ask questions and record answers. Here's a demo πŸ‘‡!

Demo

Full demo can be found on Imugr πŸ‘‰ https://imgur.com/a/gPkI95A

Ask Questions and record answers

Oilly now can ask questions like, "what is your current mileage?", and make sure to correctly record the answers in the database.

Telegram persistance problem

Unfortunately telegram wont let you send any custom data with the message you have to debend on the text you send to record answers and here where I get stuck for 3 hours trying to find a way around.

Let me explain the problem in another way:

When Oilly asks the user What is the current mileage in (km) as shown in your car dashboard? and waits for an answer there's no way for me to know wither the following text will be answer for this question or not because telegram doesn't return the message id in this case the question id, nor let you send custom data with the message.

    bot.sendMessage(chat.id, "What is the current mileage in (km) as shown in your car dashboard?", {
        reply_markup: {
            // Options that doesn't contain custom data
        },
    });
Enter fullscreen mode Exit fullscreen mode

Continue reading with images and visual aids on my blog Ahmednagi.com/oilly-telegram-bot-part-3

Top comments (0)