• Documentation
  • Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
Jonatas Baldin

Python Telegram Bot

by

This example demonstrates how to setup an echo Telegram Bot using the Serverless Framework.

  1. Python Telegram Bot

Serverless Telegram Bot

This example demonstrates how to setup an echo Telegram Bot using the Serverless Framework ⚡🤖

Built with python-telegram-bot v21+, which is fully async; the handler wraps each Bot API call with asyncio.run(...).

Usage

What do I need?

  • An AWS key configured locally, see here.
  • Node.js.
  • A Telegram account.

Installing

# Install the Serverless Framework
$ npm install serverless -g

# Install the necessary plugins
$ npm install

# Get a bot from Telegram, sending this message to @BotFather
$ /newbot

# Put the token received into a file called serverless.env.yml, like this
$ cat serverless.env.yml
TELEGRAM_TOKEN: <your_token>

# Deploy it!
$ serverless deploy

# With the URL returned in the output, configure the Webhook
$ curl -X POST https://<your_url>.amazonaws.com/dev/set_webhook

Now, just start a conversation with the bot :)

Contents

  • Serverless Telegram Bot
  • Usage
  • What do I need?
  • Installing

Related

GuidesPluginsExamplesSlack CommunitySupport