Bas… Bot Ho Gaya (carpoolbot on telegram)

Bots are lovely, bots are personal and more importantly it can be designed in a way to tell a user exactly what he might have been thinking to figure out but did not perform that action. My point over here is to understand user’s pattern and fix the gap in middle.

So i thought why not have a carpool bot, where in users can search for carpools on their route by just entering source and destination.

Why Bot ?

  • A mobile user uses 5–6 apps daily and so before downloading any app we think do we really need this app ? Can’t we just google and find the solution / service why the whole process of reinventing wheel… ok let me just get the taste of it and then i will be more comfortable downloading it
  • For many things we don’t need an app so we google, but google can’t be tailor made for a specific service in our case carpooling service.

Hence Bot, as an entrepreneur probably we don’t need to build an app and hope for a sudden behavioural change from our users, bots take the best of both the world — users don’t need to download an app initially, they can get a hold of what you have to offer and then install the app and also you give more than a search result : Tailor-made search result by using awesome tools like this , checkout more here

How to build a Telegram bot in 15 min

You need to know NodeJS , Typescript and play some deep house before going further

Install it npm install node-telegram-bot-api

const TelegramBot = require("node-telegram-bot-api");
const bot = new TelegramBot(process.env.TELEGRAM_API_KEY, {polling: true});

Yes you need TELEGRAM_API_KEY which you can get from botFather

Use the /newbot command to create a new bot. The BotFather will ask you for a name and username, then generate an authorization token for your new bot

Well now you have all the ingredients ready for perfect meal, let’s taste the power of knowledge by just adding following piece of code which will trigger everytime new user steps in or a user types /start

bot.onText(/\/start/, (msg) => {
bot.sendMessage(msg.chat.id, "Welcome", {
"reply_markup": {
"keyboard": [["Create Carpool", "Search Carpool"], ["Corporate Carpool", "Contact Us"]]
}
});
});

Last part, following piece of code is what you need to check for every input and understand the user behaviour to provide valuable results

bot.on("message", (msg) => {
const userId = msg.chat.id;

if (msg.text.toString().toLowerCase().includes("search")) {
searchInitiated(bot, msg, userId, users);
}
....
...
..
}

Just fire up your node and play around with your bot, you don’t need to do anything else to get it working, it’s already published as well, unlike any app where in one needs to set up the developer account and pay and wait and update and wait. This stuff is awesome and super fast.

Here’s how carpoolbot works

Checkout here https://t.me/carpoolbot

Stay connected to carpoolbot to see some cool route matching mixed by NLP AI and stuff… did someone mention to put reviews on blockchain ??