Create your own Telegram bot with Django on Heroku – Part 10 – Creating a view for your bot’s webhook

Header Image showing Django, Telegram, Heroku logos
This entry is part 10 of 11 in the series Create your own Telegram bot with Django on Heroku

Django_Pony

⚠️ This article is outdated and discontinued since Heroku decided to no longer offer their free tiers as this article series suggests to use in August, 2022. Please see this post for details. ⚠️

In the previous part of this series, we created another database model named Message to hold the message-data from our Telegram – bot. I also explained the process of defining a SQL schema using a Django model, what to consider during that phase and how to bring the Django’s model field reference docs to a good use during that process. Last but not least, we learned what a HerokuOne-Off Dyno” is and how it can be used to execute administrative tasks on our production site like applying outstanding migrations to a database.

This time, I will provide you with the last piece of the puzzle to make your bot available to the world. You will learn how to write and wire the Python code to actually use all that we have prepared so far. At the end of this part, your bot will be able to receive and store each message sent to it by registered users. And since it’s already more than a month since I published the previous article in this series, let’s not waste any more time and jump right in!

Continue reading “Create your own Telegram bot with Django on Heroku – Part 10 – Creating a view for your bot’s webhook”

Create your own Telegram bot with Django on Heroku – Part 9 – Creating a model for your messages

Header Image showing Django, Telegram, Heroku logos
This entry is part 9 of 11 in the series Create your own Telegram bot with Django on Heroku

Django_Pony

⚠️ This article is outdated and discontinued since Heroku decided to no longer offer their free tiers as this article series suggests to use in August, 2022. Please see this post for details. ⚠️

In the previous part of this series, I explained what a database is good for in general and Django in special. I also told about what relational database systems (RDBS) are supported by Django, what migrations and models are and how to create and apply them. Further, I introduced and explained what the Django Admin-Backend is and how to use it to create, alter or delete data in tables resulting from having applied the migrations to SQL databases from a model definition.

Today, we will create another database model to hold the message-data forwarded to our webhook by the Telegram – bot in the future. I will try my best to make this a play-along part which invites everyone to follow step by step in another console. Hopefully, it gives you an idea what thoughts and considerations are involved in writing a model for a real-world problem and how to involve Django’s documentation resources.
Continue reading “Create your own Telegram bot with Django on Heroku – Part 9 – Creating a model for your messages”

Create your own Telegram bot with Django on Heroku – Part 8 – Integrating the database

Header Image showing Django, Telegram, Heroku logos
This entry is part 8 of 11 in the series Create your own Telegram bot with Django on Heroku

Django_Pony

⚠️ This article is outdated and discontinued since Heroku decided to no longer offer their free tiers as this article series suggests to use in August, 2022. Please see this post for details. ⚠️

In the previous part of this series, we had a bit of a term definition to make it easier for beginners of Django to understand what I am talking about. Also, we created a Django – App called “bot” and created a URL routing for it to be available at (https://dry-tundra-61874.herokuapp.com)/bot/* (or whatever your URL looks like) and how to direct URLs to a view.

Originally, I planned to also show how to start using a database in Django to hold your bot’s data. But since the article grew larger than I anticipated before, I had to cut that down, unfortunately (sorry for that ?).
Today, I will deliver that part in its own article. We will learn how to work with databases in Django, what migrations are and how to interact with the database from within Django’s Admin-Backend.
Continue reading “Create your own Telegram bot with Django on Heroku – Part 8 – Integrating the database”