Introduction

In this article, I’ll show you how to create simple Telegram bot on webhooks written in Python 3 and deploy it to Swifty. To create such bot we need only little Python knowledge, Telegram account and… Swifty!

Register your bot

First of all you need to register your bot on Telegram. To create new bot you need to contact with another bot called @BotFather. Install Telegram, open this link https://telegram.me/BotFather and start the conversation. Type /newbot to start creating your bot.

/newbot

After that you need to answer a few questions: provide bot display name and username. Once your bot is created, you will be provided with the access token and URL. Save both – we will need them for our function.

Create bot function

You have multiple options to try Swifty. Swifty is available from our own Swifty.Cloud, on-premises or you can deploy it to your favourite public cloud. We have created an ansible script to allow you deploy Swifty to Amazon AWS. Here is the guide how to do it. This version of Swifty called Swifty.Lite and allows you to use all our features but with few limitations.

We are going to use our own Swifty.Cloud for this guide. Go to Swifty.Dashboard and create your bot function:

Click Functions > New Function. Switch to From repo (Templates) tab and select default repository https://github.com/swiftycloud/swifty.demo if it is not selected by default. You will see templates available from our public repository on GitHub.