Skip to content

Simple Telegram bot example on aiogram framework using Yandex Cloud with Webhook (full detailed guide)

License

Notifications You must be signed in to change notification settings

LF3551/yandex-serverless-aiogram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

yandex-serverless-aiogram-bot

Supported python versions Aiogram Yandex.Cloud

Simple Telegram bot example on aiogram framework using Yandex Cloud with Webhook

Steps

  1. First create a bot with telegram "BotFather" and copy TOKEN to your notes

  2. Go to Yandex Cloud Console

  3. Create Yandex Service account in Yandex Cloud with roles editor and serverless.functions.invoker

  4. Create Yandex Cloud Function in Yandex Cloud:

    • choose programming language, in our case it will be Python
    • copy and paste the code from index.py to file index.py in Yandex Cloud Function Editor
    • create file requirements.txt in Yandex Cloud Function Editor
    • copy and paste data from requirements.txt to file requirements.txt in Yandex Cloud Function Editor
    • select below Yandex Service account you created earlier
    • add variable TOKEN and put your token data there
    • click Create function
  5. You are back to your Yandex Cloud Function view:

    • check the box Public function
    • copy the link PUBLIC_FUNCTION_URL to your public function in notes
  6. You need to create Webhook:

    • put your TOKEN and PUBLIC_FUNCTION_URL in template below 👇
    • template: https://api.telegram.org/botTOKEN/setWebhook?url=PUBLIC_FUNCTION_URL
    • put this link to your browser and press enter
    • you will get this message: {"ok":true,"result":true,"description":"Webhook was set"}
  7. Send /start message to your bot. Everything should work 🙂

Releases

No releases published

Packages

No packages published

Languages