Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Cloud Apps
    • Demo Telegram Bot
    • Django Container
    • Image Resizer
    • Metrics Collector
    • VM Watchdog
    • VM Folder Watchdog
    • Instance Group Scheduled Scaler
  • Audit Trails events

In this article:

  • Required paid resources
  • Getting started
  • Deploy the application
  • Test your website
  1. Applications
  2. Demo Telegram Bot

Demo Telegram Bot

Written by
Yandex Cloud
Updated at January 29, 2025
  • Required paid resources
  • Getting started
  • Deploy the application
  • Test your website

A Telegram bot on a Yandex Cloud serverless stack that returns the same message sent by the user. It is implemented with Node.js and the Telegraf.js library.

You can modify the Telegram bot's skills as you see fit.

Required paid resourcesRequired paid resources

The cost of resources for the application includes:

  • Fee for the number of function calls, computing resources allocated to a function, and outgoing traffic (see Yandex Cloud Functions pricing).
  • Fee for the number of requests to the API gateway and outgoing traffic (see Yandex API Gateway pricing).
  • Fee for standard queue requests (see Yandex Message Queue pricing).
  • Secret storage and request fees (see Yandex Lockbox pricing).

Getting startedGetting started

Register your bot in Telegram and get a token:

  1. Start the BotFather bot and send the /newbot command to it.
  2. Name your bot, e.g., Serverless Echo Telegram Bot. This is the name users will see when talking to the bot.
  3. Specify a username for your bot, e.g., ServerlessHelloTelegramBot. You can use it to locate the bot in Telegram. The username must end with ...Bot or ..._bot.

Your Telegram bot's token will be displayed.

Create a Yandex Lockbox secret. In the Key field, enter TG_TOKEN, and in the Value field, enter the returned Telegram bot token.

Deploy the applicationDeploy the application

  1. In the management console, select the folder where you want to deploy the application.

  2. Select Cloud Apps.

  3. On the left-hand panel, select Marketplace.

  4. Select Demo Telegram Bot and click Use.

  5. Specify the following:

    • Application name.
    • Application description (not required).
    • Service account with the admin role for the folder, or select Auto to have the service account created when installing the application. This service account will be used to create the application resources.
    • ID of the previously created Yandex Lockbox secret.
  6. Click Install and wait for the installation to complete.

  7. On the Overview page, find the API gateway under Application resources, go to the gateway page, and copy the service domain link.

  8. To bind the function to the Telegram bot, run a request. Replace <bot_token> with your Telegram bot token, and <API_gateway_domain> with a link to your API gateway's service domain.

    Linux/macOS
    Windows (cmd)
    Windows (PowerShell)
    curl \
      --request POST \
      --url "https://api.telegram.org/bot<bot_token>/setWebhook?url=<API_gateway_domain>/echo"
    
    curl ^
      --request POST ^
      --url "https://api.telegram.org/bot<bot_token>/setWebhook?url=<API_gateway_domain>/echo"
    
    curl.exe `
      --request POST `
      --url "https://api.telegram.org/bot<bot_token>/setWebhook?url=<API_gateway_domain>/echo"
    

    Result:

    {"ok":true,"result":true,"description":"Webhook was set"}
    

Test your websiteTest your website

Write to the bot on Telegram.

Was the article helpful?

Next
Django Container
© 2025 Direct Cursus Technology L.L.C.