Creating a voice-enabled Telegram Bot for GPT Chat without DevOps: a comprehensive guide

Kirill Markin
5 min readJun 22, 2023

In this article, we will explore the process of developing a voice-enabled Telegram bot for GPT chat. Our goal is to provide a seamless and convenient user experience while minimizing the need for DevOps tasks. We will discuss the limitations of the previous solution built with PipeDream and explain why we transitioned to a more flexible platform called Railway. Additionally, we will outline the steps involved in setting up the Telegram bot using Node.js and configuring the database on Railway. Finally, we will share the GitHub repository for easy access to the bot and provide insights into its potential future enhancements.

TL;DR: Feel free to deploy your own telegram bot by our GitHub repository.

Overview of the previous PipeDream solution:

Initially, our focus was to quickly validate the feasibility of a voice-enabled Telegram bot for GPT chat. We leveraged PipeDream, a low-code automation platform similar to Zapier, to build a functional solution in just two evenings. With this approach, we were able to convert voice messages to text, send messages and chat history to the GPT chat, retrieve the responses, and send them back to the users. The development speed and the convenience offered by PipeDream validated our hypothesis and made the experience both exciting and rewarding.

Previous related article:
DIY Voice-Controlled GPT Chat: A Step-by-Step Guide for Beginners

Reasons for transitioning away from PipeDream:

While PipeDream served its purpose for rapid validation, we encountered several limitations as we started using the Telegram bot more frequently. One major drawback was the lack of automatic retries when OpenAI couldn’t handle requests, resulting in occasional response failures. Although PipeDream offered a retry function, it came at a significant cost of $200 per month, which was not feasible for a single user like us. Moreover, PipeDream lacked easy analytics collection, making it inconvenient to gather essential metrics such as daily bot users.

Another significant challenge was the inability to link multiple PipeDream automations to the Telegram bot. This restriction made it difficult to implement features like a Reset button for clearing messages. Consequently, we had to configure complex workarounds in PipeDream to support multiple commands and maintain chat conversations. These limitations prompted us to seek a more flexible solution that could address these issues and provide a better user experience.

Embracing Railway: a Versatile Platform for deploying our Telegram Bot:

After deciding to transition from PipeDream, we sought a solution that would minimize the time spent on DevOps and infrastructure tasks. Our technical director recommended Railway, a platform that perfectly fit our requirements. With Railway, we quickly set up a database to store messages, message history, user interactions, and analytical events related to the bot’s usage. Railway seamlessly integrated with our GitHub repository, handling deployment, service configuration, and automatic restarts in case of errors or crashes. This streamlined approach eliminated the need for manual server management and ensured a hassle-free experience.

Creating a Telegram bot with Node.js:

To develop the Telegram bot, we invested several evenings in writing Node.js code. Knowledge of JavaScript and TypeScript is essential for this step, although Python can also be used. For those without coding skills, hiring an experienced developer is recommended, but even junior developers can utilize existing code snippets available online. We have made our Telegram bot code openly accessible on GitHub, providing a starting point for customization by less experienced developers.

Configuring the Database on Railway for Easy Deployment:

Traditionally, setting up and maintaining a database requires remembering various commands and performing tedious tasks. However, Railway simplified the process significantly. With a few clicks, we created a Postgres database, set up tables for messages, users, and events, and obtained a secret access string for database connectivity. This streamlined approach allowed us to effortlessly manage the storage of message history, user access, and analytical data.

Key takeaways and repository access for the Voice-Enabled GPT Chat Bot:

After completing the development of the bot, we shared it with our relatives, who embraced the voice-controlled GPT chat in Telegram enthusiastically. Their positive response encouraged us to extend the bot’s usage to some of our clients, who also preferred the voice interface over text-based GPT chat. We later discovered that OpenAI released an iPhone app featuring voice dictation for GPT chat, further validating our choice of a voice-enabled Telegram bot. Currently, we are considering additional features such as pinned message support and exploring different chat roles and switching capabilities.

To access our work and deploy the bot, you can find the link to our GitHub repository below. Railway offers free deployment, enabling you to test the bot firsthand. For any queries or assistance, please don’t hesitate to reach out to us.

Feel free to deploy your own telegram bot by our GitHub repository.

Conclusion

In conclusion, we have explored the process of creating a voice-enabled Telegram bot for GPT chat without the need for extensive DevOps involvement. We transitioned from PipeDream to Railway to overcome limitations and enhance the user experience. By leveraging Node.js and Railway’s database capabilities, we developed a robust and user-friendly solution. We shared our GitHub repository for easy access and encouraged readers to deploy the bot using Railway. Should you have any questions or require assistance, feel free to contact us. Kirill Markin, the creator of ozma.io, a low-code CRM and ERP system builder, is passionate about data science, databases, and artificial intelligence, and is always eager to help.

--

--