Today, from empty beer cans and old tires, we will assemble a telegram bot for a taxi. With it, it will be possible to call a taxi by pressing only two buttons. Or rather: when you first use it, you will need to press three buttons, and then always only two. The code is written in Node.js (i.e. ECMAScript , aka JavaScript ), without using any bot frameworks or bot libraries - only a natural product - Telegram Bot API . The amount of code is indicated in the title of the article, it is executed in Yandex.Cloud , more precisely in Cloud Functions , and the states and data are stored in Firebase , or rather in Cloud Firestore. Well, our modest bot sends taxi applications to Bitrix24 CRM . As you can see, everyone is involved! You can look at the bot itself on the comics below, and by clicking on the picture link under the comics, open and check in action.What is this bot
Comic # 1 : Open and launch the bot.
Comic # 2 : Yes, you have to give a phone number. Moreover, the bot will write it to the database so as not to ask each time.
Comic # 3 : We give the bot its coordinates. But their bot will not save, quite rightly believing that you can move slightly.
Comic # 4 : Get Order Confirmation. And our smart bot prevents the flood attempt.
Comic # 5 : Meanwhile, the order arrives at Bitrix24 CRM.
Comic # 6 : The taxi dispatcher sees all the necessary data, and can call his potential client.Would you like to try? Please - click on the picture below. And donโt worry - your phone number will not be traded on โGorbushkaโ (and elsewhere).
: https://t.me/InstantTaxiBotAbout how to create Telegram bots and even in Yandex.Cloud - read the tutorial Building a Telegram bot in Yandex.Cloud .
The bot code in Yandex.Cloud. Readhow to connect the code from Yandex Cloud Functions to the Firebase Cloud Firestore database in the tutorial Alice remembers everything .
Bot data in Cloud Firestore.Read about how to transfer data to Bitrix24 CRM in the Alice tutorial in Bitrix .The code itself should be completely understandable, in addition, it is very generously commented. Just read it as archivists read manuscripts.
Link to GitHab:https://github.com/stmike/tg-bot-taxi.gitgit clone https:
cd tg-bot-taxi
npm install
There is, of course, something to think about to improve usability (forgive me, my God), and also, in the case of making a bot for a legal entity in the Russian Federation, we should not forget about the gloriously well-known law (either Yarovaya or Winter) - FZ 152 . In addition, you can think about using this code not only to call a taxi, but also to deliver donuts or transfer grandmothers through the roadway. Wherever we need to know the user's location and his contacts - this can be easily adapted.Conclusion
That's all for today. Other materials follow. To whom it is interesting to read, subscribe to notifications of new publications. You can subscribe on this site (the Subscribe button below), or on the Telegram channel IT Tutorial Zakhar , or on the community of the same name on VK , or Twitter @mikezaharov .Donuts
