Inspiration

The ongoing Circuit Breaker has forced many people to stay at home, making it extremely inconvenient for others to leave the house. With that in mind, we decided to create this telegram bot to help others to perform errands where it is convenient (such as helping your neighbors or others that live near you) to promote acts of kindness.

What it does

This telegram bot has the following features:

  • One can directly interact with the bot to post a request on the public channel, where others can see, indicate if they are interested to help, and directly contact the requester if needed

  • In the channel, the public can interact with the channel directly by clicking on the two buttons: one to directly message the requester to discuss details etc. and one to indicate to the database that he will be helping the requester.

  • After this, the requester can also update the request in the bot such that mark the request in the database as "done" if the errand was completed, or "deleted" if the requester decides to withdraw the request.

How I built it

We started by reading up on how telegram APIs work and how they can be implemented. We search for existing templates that we could use to fasten the process, which we managed to find a github repository that has plenty of python implementations with the Telegram bot API ([link] https://github.com/eternnoir/pyTelegramBotAPI ).

We then proceed to work on the basic command functions with the assistance of tutorial videos and plenty of articles and telegram API documentations, slowly working our way to adding the database to store the relevant information (such as username ID, request, location etc.) on a local server with mySQL and phpMyAdmin.

Following this, we added features such as inline key buttons to enhance the ease of usage of the bot and the channel, as well as other attributes like utilizing hashtags to make it easier to filter the requests in the channel by location.

Challenges I ran into

Initially, we ran into several problems as we are unfamiliar to creating telegram bots and learning about APIs and how to implement them in general. Therefore, our first major hurdle was to create an initial chat bot and implement many basic features, although we managed to overcome this early on. Later on, the implementation of additional features such as inline buttons and utilizing callback queries etc. was constantly filled with bugs and errors -- which we also managed to implement correctly and correct after much effort.

Accomplishments that I'm proud of

I'm proud of the fact that despite being three inexperienced coders who has never actually properly implemented a proper python project (with a database, albeit a very simple one), have actually managed to produce a working telegram bot that can be used by others. As this is our first time being exposed to such knowledge, and this being our first hackathon as well, I'm proud that we have overcome the multiple obstacles along the way and managed to finish this.

What I learned

We learnt a lot about how APIs work and how they are implemented, how JSON works in relation to telegram, and in general, how to create a working telegram bot with features such as inline keyboard buttons and commands using Python. We also got to experience how to link the SQL database with our telegram bots.

Another lesson we learnt is that in a project such as this, even though it is small-scaled, teamwork is extremely important. In the beginning, our workflow wasn't synchronized, which resulted in quite a bit of inefficiency in our work, but towards the middle, we managed to disseminate our workload with greater efficiency, and complete more work in a shorter period of time.

What's next for Covid

We would like to further improve on the bot by adding additional features such as the ability to delete the messages from the channel directly. Another improvement we would love to add is to implement different channels for different regions as currently, all the requests are in one centralized channel.

If possible we would like to add even more complex enhancements, such as incorporating information such as being able to see which malls/ shops are open(?) for specific types of requests or other services like seeing the number of people inside of supermarkets (due to the limited number of people allowed in supermarkets nowadays) to prevent crowding.

Built With

Share this project:

Updates